Functionality Deprecated in PHP 8.5
Receiving the following deprecation message with v3.1.3 running php 8.5 RC2:
PHP Deprecated: ord(): Providing an empty string is deprecated in \vendor\dompdf\php-font-lib\src\FontLib\BinaryStream.php on line 161
Here's the detailed issue in php 8.5
PHPUnit 12.4.4 by Sebastian Bergmann and contributors.
Runtime: PHP 8.5.0
Configuration: K:\dev\github\php-font-lib\phpunit.xml
..DD 4 / 4 (100%)
Time: 00:02.423, Memory: 16.00 MB
2 tests triggered 1 PHP deprecation:
1) K:\dev\github\php-font-lib\src\FontLib\BinaryStream.php:161
ord(): Providing an empty string is deprecated
Triggered by:
* FontLib\Tests\FontTest::testGetFontInfoTTF (236 times)
K:\dev\github\php-font-lib\tests\FontLib\FontTest.php:32
* FontLib\Tests\FontTest::testTTFCmap (85 times)
K:\dev\github\php-font-lib\tests\FontLib\FontTest.php:46
The source of the problem is that the following expression is deprecated in php 8.5
var_dump(ord(''));
// int(0)
and needs to be replaced by
var_dump(ord('0'));
// int(0)
This happens here:
https://github.com/8ctopus/php-font-lib/blob/9b42ff4995cb53d3a2f7edd016f0ed39a70887a7/src/FontLib/BinaryStream.php#L160-L162
when read returns an empty string.
https://github.com/8ctopus/php-font-lib/blob/9b42ff4995cb53d3a2f7edd016f0ed39a70887a7/src/FontLib/BinaryStream.php#L144-L150