php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60569 Nullbyte truncates Exception $message.
Submitted: 2011-12-20 04:17 UTC Modified: 2012-04-20 01:40 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: hanskrentel at yahoo dot de Assigned: iliaa (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.8 OS: Fedora 14
Private report: No CVE-ID: None
 [2011-12-20 04:17 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-11 18:15 UTC] 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).
 [2012-03-11 18:15 UTC] 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 UTC] iliaa@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: iliaa
 [2012-03-14 10:52 UTC] hanskrentel at yahoo dot de
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";
 [2012-03-19 11:50 UTC] hanskrentel at yahoo dot de
-Status: Closed +Status: Assigned
 [2012-03-19 11:50 UTC] hanskrentel at yahoo dot de
Re-open because it is not fixed.
 [2012-04-18 09:45 UTC] laruence@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d4f05fbffc6f63e094c0f737e0477e27f1bf5f7f
Log: Fixed bug #60569 (Nullbyte truncates Exception $message).
 [2012-04-20 01:40 UTC] felipe@php.net
I got the expected result:
Original Message..: Null Char  Test.
Processed Message.: Null Char  Test.
 [2012-07-24 23:36 UTC] rasmus@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d4f05fbffc6f63e094c0f737e0477e27f1bf5f7f
Log: Fixed bug #60569 (Nullbyte truncates Exception $message).
 [2013-11-17 09:33 UTC] laruence@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d4f05fbffc6f63e094c0f737e0477e27f1bf5f7f
Log: Fixed bug #60569 (Nullbyte truncates Exception $message).
 [2013-11-17 09:33 UTC] laruence@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 07:01:29 2024 UTC