Bug #60569 [Csd]: Nullbyte truncates Exception $message.
| From: | hanskrentel at yahoo dot de | Date: | Wed, 14 Mar 2012 10:52:47 +0000 |
| Subject: | Bug #60569 [Csd]: Nullbyte truncates Exception $message. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-168449@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60569&edit=1
ID: 60569
User updated by: hanskrentel at yahoo dot de
Reported by: hanskrentel at yahoo dot de
Summary: Nullbyte truncates Exception $message.
Status: Closed
Type: Bug
Package: Scripting Engine problem
Operating System: Fedora 14
PHP Version: 5.3.8
Assigned To: iliaa
Block user comment: N
Private report: N
New Comment:
Tested against PHP trunk Revision: 324199 (Windows), there still is truncation on
the NULL char.
$original = "Null Char \0 Test.";
echo "Original Message..: ", $original, "\n";
$e = new Exception($original);
$processed = $e->getMessage();
echo "Processed Message.: ", $processed, "\n";
Previous Comments:
------------------------------------------------------------------------
[2012-03-11 18:15:12] iliaa@php.net
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2012-03-11 18:15:03] iliaa@php.net
Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&revision=324112
Log: Fixed bug #60569 (Nullbyte truncates Exception $message).
------------------------------------------------------------------------
[2011-12-20 04:17:32] hanskrentel at yahoo dot de
Description:
------------
When an Exception class is instantiated and a string contain a nullbyte character ("\0")
is used as $message, Exception::getMessage() returns a truncated string (the protected member
Exception::$message is truncated as well).
Looks like a duplicate of https://bugs.php.net/bug.php?id=50085 which
outlined this as documentation problem. No idea why this is a documentation problem.
Test script:
---------------
$e = new Exception("test\0me");
echo $e->getMessage();
Expected result:
----------------
output (not displaying non-printable characters):
testme
Actual result:
--------------
output (not displaying non-printable characters):
test
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60569&edit=1