Skip to content

Functionality Deprecated in PHP 8.5 #151

Description

@Cr0aten

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

Activity

  1. transferred this issue fromdompdf/dompdfon Oct 23, 2025
  2. added this to the 1.0.2 milestone on Oct 23, 2025
  3. 8ctopus commented on Nov 27, 2025

    @8ctopus
    Contributor

    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
  4. 8ctopus commented on Nov 27, 2025

    @8ctopus
    Contributor

    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

  5. linked a pull request that will close this issueFix php 8.5 deprecation #152on Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions