Skip to content

Commit 23298f8

Browse files
committed
chore: ci
1 parent 4dfed9e commit 23298f8

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

src/PhpWord/Element/Image.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -627,15 +627,12 @@ public function getSvgDimensions(string $file): array
627627
}
628628
$svg = $dom->documentElement;
629629

630-
// 1) essai sur width/height
631630
$wAttr = round((float) $svg->getAttribute('width'));
632631
$hAttr = round((float) $svg->getAttribute('height'));
633632

634-
635633
$w = (int) filter_var($wAttr, FILTER_SANITIZE_NUMBER_INT);
636634
$h = (int) filter_var($hAttr, FILTER_SANITIZE_NUMBER_INT);
637635

638-
// 2) fallback viewBox si l’un ou les deux sont à zéro
639636
if ($w <= 0 || $h <= 0) {
640637
$vb = $svg->getAttribute('viewBox');
641638
if (preg_match('/^\s*[\d.+-]+[\s,]+[\d.+-]+[\s,]+([\d.+-]+)[\s,]+([\d.+-]+)\s*$/', $vb, $m)) {

src/PhpWord/Shared/Microsoft/PasswordEncoder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ public static function hashPassword($password, $algorithmName = self::ALGORITHM_
119119
// Get the single-byte values by iterating through the Unicode characters of the truncated password.
120120
// For each character, if the low byte is not equal to 0, take it. Otherwise, take the high byte.
121121
$passUtf8 = mb_convert_encoding($password, 'UCS-2LE', 'UTF-8');
122+
123+
if (!is_string($passUtf8)) {
124+
throw new \InvalidArgumentException('mb_convert_encoding() failed to convert password to UCS-2LE.');
125+
}
126+
122127
$byteChars = [];
123128

124129
for ($i = 0; $i < mb_strlen($password); ++$i) {

src/PhpWord/Shared/Text.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ public static function toUTF8($value = '')
148148
if (null !== $value && !self::isUTF8($value)) {
149149
// PHP8.2 : utf8_encode is deprecated, but mb_convert_encoding always usable
150150
$value = (function_exists('mb_convert_encoding')) ? mb_convert_encoding($value, 'UTF-8', 'ISO-8859-1') : utf8_encode($value);
151+
if (is_bool($value)) {
152+
$value = null;
153+
}
154+
151155
}
152156

153157
return $value;

src/PhpWord/Style/Chart.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,7 @@ public function getValueLabelPosition()
457457
* "low" - sets labels are below the graph
458458
* "high" - sets labels above the graph.
459459
*
460-
* @param string
461-
* @param mixed $labelPosition
460+
* @param string $labelPosition
462461
*/
463462
public function setValueLabelPosition($labelPosition)
464463
{

tests/bootstrap.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ function phpunit10ErrorHandler(int $errno, string $errstr, string $filename, int
5454

5555
function utf8decode(string $value, string $toEncoding = 'ISO-8859-1'): string
5656
{
57-
return function_exists('mb_convert_encoding') ? mb_convert_encoding($value, $toEncoding, 'UTF-8') : utf8_decode($value);
57+
$value = function_exists('mb_convert_encoding') ? mb_convert_encoding($value, $toEncoding, 'UTF-8') : utf8_decode($value);
58+
if (is_bool($value)) {
59+
$value = '';
60+
}
61+
return $value;
5862
}
5963

6064
if (!method_exists(PHPUnit\Framework\TestCase::class, 'setOutputCallback')) {

0 commit comments

Comments
 (0)