[php-src] Issue #24504: `Time\Duration::fromIso8601DurationString()` ignores everything after a NUL byte.

From: Date: Wed, 21 Oct 2026 20:16:29 +0000
Subject: [php-src] Issue #24504: `Time\Duration::fromIso8601DurationString()` ignores everything after a NUL byte.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-253062@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/24504 Author: azjezz ### Description The following code: ```php <?php foreach (["PT1Sgarbage", "PT1S\0garbage", "PT1H\0x", "PT1S\0"] as $input) { try { $d = Time\Duration::fromIso8601DurationString($input); printf("%-18s => accepted: %d s\n", json_encode($input), $d->seconds); } catch (Time\TimeException $e) { printf("%-18s => rejected: %s\n", json_encode($input), $e->getMessage()); } } ``` Resulted in this output: ``` "PT1Sgarbage" => rejected: The ISO 8601 duration string could not be parsed "PT1S\u0000garbage" => accepted: 1 s "PT1H\u0000x" => accepted: 3600 s "PT1S\u0000" => accepted: 1 s ``` But I expected this output instead: ``` "PT1Sgarbage" => rejected "PT1S\u0000garbage" => rejected "PT1H\u0000x" => rejected "PT1S\u0000" => rejected ``` ### PHP Version ```plain PHP 8.6.0RC3 (cli) (built: Oct 20 2026 18:44:56) (NTS) Copyright © The PHP Group and Contributors Zend Engine v4.6.0RC3, Copyright © Zend by Perforce with Zend OPcache v8.6.0RC3, Copyright ©, by Zend by Perforce ``` ### Operating System MacOS

« previous php.bugs (#253062) next »