Bug #61362 [Ana->Csd]: Exception::getTraceAsString, Exception::__toString not able to handle unicode
| From: | nikic@php.net | Date: | Wed, 17 Jun 2015 20:31:23 +0000 |
| Subject: | Bug #61362 [Ana->Csd]: Exception::getTraceAsString, Exception::__toString not able to handle unicode | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-193627@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61362&edit=1
ID: 61362
Updated by: nikic@php.net
Reported by: sam at rmcreative dot ru
Summary: Exception::getTraceAsString, Exception::__toString
not able to handle unicode
-Status: Analyzed
+Status: Closed
Type: Bug
Package: Unicode Engine related
Operating System: All
PHP Version: 7.0.0
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=653c869348b7626d43a30f67be9362fbcce10d2b
Log: Fix #61362: Exception::getTraceAsString and ::__toString scramble Unicode
Previous Comments:
------------------------------------------------------------------------
[2015-06-17 14:17:15] cmb@php.net
See <http://3v4l.org/ONJBe>. As of PHP 5.4.29 the result
is
correct, but master shows a regression.
The problem is that c is declared as char[1], what is a signed
value, but the following calculations assume it is unsigned.
Simply declaring
unsigned char c = s[i];
should solve the problem.
I'm working on a PR (including a respective test).
[1] <http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_exceptions.c#402>
------------------------------------------------------------------------
[2012-03-14 17:20:50] tony2001@php.net
The problem is here: http://lxr.php.net/opengrok/xref/PHP_5_4/Zend/zend_exceptions.c#391
Dunno what to do in this case: either add to the docs that the result of getTraceAsString() is
perfectly safe from binary symbols or drop that code completely and allow any chars there.
------------------------------------------------------------------------
[2012-03-14 15:16:42] sam at rmcreative dot ru
It's UTF8 already.
------------------------------------------------------------------------
[2012-03-14 15:14:58] tony2001@php.net
Nevermind, I see the problem.
------------------------------------------------------------------------
[2012-03-14 12:20:41] tony2001@php.net
What if you try to switch your browser encoding to UTF8 from whatever it is by default?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=61362
--
Edit this bug report at https://bugs.php.net/bug.php?id=61362&edit=1