Skip to content

Commit 793dc76

Browse files
authored
Merge pull request #50 from eclipxe13/maintenance
Compatibilidad con PHP 8.5, dependencias con CVE y json_validate (version 0.6.1)
2 parents 2c9711f + 265e2d7 commit 793dc76

48 files changed

Lines changed: 128 additions & 101 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
runs-on: "ubuntu-latest"
9999
strategy:
100100
matrix:
101-
php-version: ['8.1', '8.2', '8.3', '8.4']
101+
php-version: ['8.1', '8.2', '8.3', '8.4', '8.5']
102102
steps:
103103
- name: Checkout
104104
uses: actions/checkout@v4

.phive/phars.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="phpcs" version="^3.13.5" installed="3.13.5" location="./tools/phpcs" copy="false"/>
4-
<phar name="phpcbf" version="^3.13.5" installed="3.13.5" location="./tools/phpcbf" copy="false"/>
5-
<phar name="php-cs-fixer" version="^3.89.2" installed="3.89.2" location="./tools/php-cs-fixer" copy="false"/>
6-
<phar name="phpstan" version="^2.1.31" installed="2.1.31" location="./tools/phpstan" copy="false"/>
3+
<phar name="phpcs" version="^4.0.1" installed="4.0.1" location="./tools/phpcs" copy="false"/>
4+
<phar name="phpcbf" version="^4.0.1" installed="4.0.1" location="./tools/phpcbf" copy="false"/>
5+
<phar name="php-cs-fixer" version="^3.92.5" installed="3.92.5" location="./tools/php-cs-fixer" copy="false"/>
6+
<phar name="phpstan" version="^2.1.36" installed="2.1.36" location="./tools/phpstan" copy="false"/>
77
<phar name="composer-normalize" version="^2.48.2" installed="2.48.2" location="./tools/composer-normalize" copy="false"/>
88
</phive>

.php-cs-fixer.dist.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
'no_empty_statement' => true,
2525
'no_extra_blank_lines' => true,
2626
'type_declaration_spaces' => true,
27-
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['arrays', 'match', 'parameters']],
27+
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['array_destructuring', 'arrays', 'match', 'arguments', 'parameters']],
2828
'no_blank_lines_after_phpdoc' => true,
2929
'object_operator_without_whitespace' => true,
3030
'binary_operator_spaces' => true,
@@ -38,6 +38,7 @@
3838
'concat_space' => ['spacing' => 'one'],
3939
'linebreak_after_opening_tag' => true,
4040
'fully_qualified_strict_types' => true,
41+
'global_namespace_import' => ['import_classes' => true],
4142
// symfony:risky
4243
'no_alias_functions' => true,
4344
'self_accessor' => true,

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2019 - 2025 PhpCfdi https://www.phpcfdi.com/
3+
Copyright (c) 2019 - 2026 PhpCfdi https://www.phpcfdi.com/
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@
3232
"phpcfdi/credentials": "^1.3.0",
3333
"phpcfdi/xml-cancelacion": "^2.0.5",
3434
"psr/log": "^3.0",
35-
"robrichards/xmlseclibs": "^3.1.3"
35+
"robrichards/xmlseclibs": "^3.1.4"
3636
},
3737
"require-dev": {
3838
"ext-fileinfo": "*",
3939
"eclipxe/cfdiutils": "^3.0.1",
4040
"phpcfdi/rfc": "^1.2",
41-
"phpunit/phpunit": "^10.5",
41+
"phpunit/phpunit": "^10.5.50",
4242
"rector/rector": "^2.2",
4343
"symfony/dotenv": "^6.0 || ^7.0"
4444
},

docs/CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,26 @@ Nos apegamos a [SEMVER](SEMVER.md), revisa la información para entender mejor e
66

77
Estos cambios se aplican y se publican, pero aún no son parte de una versión liberada.
88

9+
## Versión 0.6.1 2026-02-04
10+
11+
- Se comprueba la compatibilidad con PHP 8.5.
12+
- Se actualizan dependencias para evitar alertas de seguridad (CVE).
13+
- Se agrega una validación para prevenir el uso de `json_validate` en versiones de PHP donde no se soporta.
14+
15+
Se hacen varios cambios menores:
16+
17+
- Actualización del estándar de código.
18+
- Actualización del año de licencia a 2026.
19+
20+
Se hacen varios cambios al entorno de desarrollo:
21+
22+
- Se agrega PHP 8.5 a la matriz de pruebas.
23+
- Se actualizan las herramientas de desarrollo.
24+
925
## Versión 0.6.0 2025-11-08
1026

1127
Esta versión tiene cambios importantes dado que:
28+
1229
- Elimina la compatibilidad con PHP 7.3, PHP 7.4 y PHP 8.0.
1330
- Agrega la compatibilidad con PHP 8.4.
1431

src/Finkok.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ protected function executeService(string $method, object $service, ?object $comm
160160
$method = static::SERVICES_MAP[$method][2] ?? $method;
161161
if (! is_callable([$service, $method])) {
162162
throw new BadMethodCallException(
163-
sprintf('The service %s does not have a method %s', $service::class, $method)
163+
sprintf('The service %s does not have a method %s', $service::class, $method),
164164
);
165165
}
166166
return $service->{$method}($command);

src/FinkokSettings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function createCallerForService(
7575
$wsdlLocation = $this->environment()->endpoint($service);
7676
$credentials = array_merge(
7777
('' !== $usernameKey) ? [$usernameKey => $this->username()] : [],
78-
('' !== $passwordKey) ? [$passwordKey => $this->password()] : []
78+
('' !== $passwordKey) ? [$passwordKey => $this->password()] : [],
7979
);
8080
return $this->soapFactory()->createSoapCaller($wsdlLocation, $credentials);
8181
}

src/Helpers/DocumentSigner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function signDocumentUsingCredential(DOMDocument $document, Credential $c
6969
$document,
7070
XMLSecurityDSig::SHA1,
7171
['http://www.w3.org/2000/09/xmldsig#enveloped-signature'],
72-
['force_uri' => true]
72+
['force_uri' => true],
7373
);
7474

7575
$objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, ['type' => 'private']);

src/Helpers/JsonDecoderLogger.php

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,17 @@ public function log($level, string|Stringable $message, array $context = []): vo
8181
private function jsonDecode(string|Stringable $string): string
8282
{
8383
$this->lastMessageWasJsonValid = false;
84-
$string = strval($string);
8584

8685
// json_validate and json_decode
87-
if ($this->useJsonValidateIfAvailable && function_exists('\json_validate')) {
88-
if (\json_validate($string)) {
89-
$this->lastMessageWasJsonValid = true;
90-
return $this->varDump(json_decode($string));
86+
if ($this->useJsonValidateIfAvailable) {
87+
$string = $this->jsonDecodeWithValidate($string);
88+
if ($this->lastMessageWasJsonValid()) {
89+
return $string;
9190
}
92-
93-
return $string;
9491
}
9592

9693
// json_decode only
94+
$string = (string) $string;
9795
$decoded = json_decode($string);
9896
if (JSON_ERROR_NONE === json_last_error()) {
9997
$this->lastMessageWasJsonValid = true;
@@ -103,6 +101,17 @@ private function jsonDecode(string|Stringable $string): string
103101
return $string;
104102
}
105103

104+
private function jsonDecodeWithValidate(string|Stringable $string): string
105+
{
106+
$string = (string) $string;
107+
if (function_exists('json_validate') && json_validate($string)) {
108+
$this->lastMessageWasJsonValid = true;
109+
return $this->varDump(json_decode($string));
110+
}
111+
112+
return $string;
113+
}
114+
106115
private function varDump(mixed $var): string
107116
{
108117
return print_r($var, true);

0 commit comments

Comments
 (0)