Problem
ValidatorIE::validateIENew() uses the ++ operator on a string variable ($checkChar++ on line 79) to walk the alphabet. Since PHP 8.3, incrementing a non-numeric string with ++ is deprecated and triggers:
Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead
This happens when validating Irish VAT numbers where the checksum character is not W (i.e., $checkVal is greater than 0).
Stack trace:
ValidatorIE.php:79 in validateIENew()
ValidatorIE.php:35 in validate()
Vies.php:389 in validateVatSum()
Vies.php:310 in validateVat()
Affected code
// src/Vies/Validator/ValidatorIE.php, lines 77-80
$checkChar = 'A';
for ($i = $checkVal - 1; $i > 0; $i--) {
$checkChar++;
}
Suggested fix
Replace the loop with chr() arithmetic:
$checkChar = chr(ord('A') + $checkVal - 1);
This works on all PHP versions and eliminates the loop entirely.
Environment
- PHP 8.4
- dragonbe/vies 2.3.2
Problem
ValidatorIE::validateIENew()uses the++operator on a string variable ($checkChar++on line 79) to walk the alphabet. Since PHP 8.3, incrementing a non-numeric string with++is deprecated and triggers:This happens when validating Irish VAT numbers where the checksum character is not
W(i.e.,$checkValis greater than 0).Stack trace:
Affected code
Suggested fix
Replace the loop with
chr()arithmetic:This works on all PHP versions and eliminates the loop entirely.
Environment