|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79899 assert() is not binary-safe
Submitted: 2020-07-26 18:14 UTC Modified: 2020-07-27 15:27 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: fpoirotte+php-bugs at gmail dot com Assigned:
Status: Open Package: PHP options/info functions
PHP Version: 7.4.8 OS: Debian GNU/Linux Bullseye
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
32 - 4 = ?
Subscribe to this entry?

 [2020-07-26 18:14 UTC] fpoirotte+php-bugs at gmail dot com
The $description argument of assert() is not binary-safe.
When the description is displayed, it will get truncated at the first null (\0) byte.

Test script:

// run with: php -d zend.assertions=1 -f /tmp/test.php

ini_set("display_errors", 1);
assert_options(ASSERT_ACTIVE, true);
assert_options(ASSERT_WARNING, true);

assert(false, "foo\000bar");

Expected result:
Warning: assert(): foobar failed in /tmp/test.php on line 10

Actual result:
Warning: assert(): foo failed in /tmp/test.php on line 10


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-07-27 15:27 UTC]
-Package: Unknown/Other Function +Package: PHP options/info functions
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Oct 30 04:01:20 2020 UTC