Bug #79899 [Opn->Wfx]: assert() is not binary-safe

From: Date: Fri, 12 Mar 2021 11:25:52 +0000
Subject: Bug #79899 [Opn->Wfx]: assert() is not binary-safe
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232670@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79899&edit=1 ID: 79899 Updated by: cmb@php.net Reported by: fpoirotte+php-bugs at gmail dot com Summary: assert() is not binary-safe -Status: Open +Status: Wont fix Type: Bug Package: PHP options/info functions Operating System: Debian GNU/Linux Bullseye PHP Version: 7.4.8 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Using assert_options() is discouraged as of PHP 7.0.0, and I don't see any valid reason not to enable assert.exception (what is actually the default as of PHP 8.0.0), since assertions are a development feature, and a failing assertion hints at a programming error. The exception shows the full description, so there is no issue, besides that there is no good reason to include NUL bytes in the description in the first place. Previous Comments: ------------------------------------------------------------------------ [2020-07-26 18:14:15] fpoirotte+php-bugs at gmail dot com Description: ------------ 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: --------------- <?php // run with: php -d zend.assertions=1 -f /tmp/test.php error_reporting(E_ALL); 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79899&edit=1

« previous php.bugs (#232670) next »