Bug #61362 [NEW]: Exception::getTraceAsString, Exception::__toString not able to handle unicode

From: Date: Mon, 12 Mar 2012 15:44:19 +0000
Subject: Bug #61362 [NEW]: Exception::getTraceAsString, Exception::__toString not able to handle unicode
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-168376@lists.php.net to get a copy of this message
From:             
Operating system: All
PHP version:      5.4.0
Package:          Unicode Engine related
Bug Type:         Bug
Bug description:Exception::getTraceAsString, Exception::__toString not able to handle unicode

Description:
------------
Exception::getTraceAsString, Exception::__toString are not able to properly
handle unicode in stack trace. Instead of showing actual argument values
it's giving ???? in case value is unicode.

Tested on PHP 5.3 and PHP 5.4.

Test script:
---------------
<?php
function test($arg){
	throw new Exception();
}

try {
	test('тест');
}
catch(Exception $e) {
	echo $e->getTraceAsString();
	echo (string)$e;
}

Expected result:
----------------
d:\web\usr\local\php54>php.exe d:\src\exception_wrong_trace\test.php
#0 D:\src\exception_wrong_trace\test.php(7): test('тест')
#1 {main}exception 'Exception' in D:\src\exception_wrong_trace\test.php:3
Stack trace:
#0 D:\src\exception_wrong_trace\test.php(7): test('тест')
#1 {main}

Actual result:
--------------
d:\web\usr\local\php54>php.exe d:\src\exception_wrong_trace\test.php
#0 D:\src\exception_wrong_trace\test.php(7): test('????')
#1 {main}exception 'Exception' in D:\src\exception_wrong_trace\test.php:3
Stack trace:
#0 D:\src\exception_wrong_trace\test.php(7): test('????')
#1 {main}

-- 
Edit bug report at https://bugs.php.net/bug.php?id=61362&edit=1
-- 
Try a snapshot (PHP 5.4):            https://bugs.php.net/fix.php?id=61362&r=trysnapshot54
Try a snapshot (PHP 5.3):            https://bugs.php.net/fix.php?id=61362&r=trysnapshot53
Try a snapshot (trunk):              https://bugs.php.net/fix.php?id=61362&r=trysnapshottrunk
Fixed in SVN:                        https://bugs.php.net/fix.php?id=61362&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61362&r=needdocs
Fixed in release:                    https://bugs.php.net/fix.php?id=61362&r=alreadyfixed
Need backtrace:                      https://bugs.php.net/fix.php?id=61362&r=needtrace
Need Reproduce Script:               https://bugs.php.net/fix.php?id=61362&r=needscript
Try newer version:                   https://bugs.php.net/fix.php?id=61362&r=oldversion
Not developer issue:                 https://bugs.php.net/fix.php?id=61362&r=support
Expected behavior:                   https://bugs.php.net/fix.php?id=61362&r=notwrong
Not enough info:                     https://bugs.php.net/fix.php?id=61362&r=notenoughinfo
Submitted twice:                     https://bugs.php.net/fix.php?id=61362&r=submittedtwice
register_globals:                    https://bugs.php.net/fix.php?id=61362&r=globals
PHP 4 support discontinued:          https://bugs.php.net/fix.php?id=61362&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=61362&r=dst
IIS Stability:                       https://bugs.php.net/fix.php?id=61362&r=isapi
Install GNU Sed:                     https://bugs.php.net/fix.php?id=61362&r=gnused
Floating point limitations:          https://bugs.php.net/fix.php?id=61362&r=float
No Zend Extensions:                  https://bugs.php.net/fix.php?id=61362&r=nozend
MySQL Configuration Error:           https://bugs.php.net/fix.php?id=61362&r=mysqlcfg



Thread (10 messages)

« previous php.bugs (#168376) next »