From: mahesh dot vemula at in dot ibm dot com
Operating system: RHEL4, Windows XP
PHP version: 6CVS-2007-10-05 (snap)
PHP Bug Type: Strings related
Bug description: strtr() crashes when $from argument is empty string or null,
with Unicode ON
Description:
------------
strtr() crashes on php6 with unicode ON , when $from argument is given as
any of the following:
empty string
Null
e.g:
var_dump( strtr("hello", array("" => "string") ) );
var_dump( strtr("hello", "", "string") );
This is applicable for PHP6 with Unicode.
Reproduce code:
---------------
<?php
var_dump( strtr("hello", array("" => "string") ) );
var_dump( strtr("hello", array('' => "string") ) );
var_dump( strtr("hello", array(null => "string") ) );
var_dump( strtr("hello", array(NULL => "string") ) );
var_dump( strtr("hello", "", "string") );
var_dump( strtr("hello", '', "string") );
var_dump( strtr("hello", NULL, "string") );
var_dump( strtr("hello", null, "string") );
?>
Expected result:
----------------
unicode(5) "hello"
unicode(5) "hello"
unicode(5) "hello"
unicode(5) "hello"
unicode(5) "hello"
unicode(5) "hello"
unicode(5) "hello"
unicode(5) "hello"
Actual result:
--------------
On Windows: crashes
On linux(RHEL4):
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate 1066789985 bytes) in %s on line %d
--
Edit bug report at http://bugs.php.net/?id=42861&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42861&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42861&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42861&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42861&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42861&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42861&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42861&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42861&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42861&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42861&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42861&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42861&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42861&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42861&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42861&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42861&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42861&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42861&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42861&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42861&r=mysqlcfg