#41592 [NEW]: print_r() truncates attribute / property names containing NULL

From: Date: Mon, 04 Jun 2007 22:59:30 +0000
Subject: #41592 [NEW]: print_r() truncates attribute / property names containing NULL
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-113371@lists.php.net to get a copy of this message
From: php at digitalbacon dot us Operating system: Windows XP (recent) PHP version: 5.2.3 PHP Bug Type: Unknown/Other Function Bug description: print_r() truncates attribute / property names containing NULL Description: ------------ If you have a property name containing a NULL character, some PHP routines like print_r() will truncate the name, most likely due to C-string processing limitations. I know PHP syntax doesn't permit NULL characters within attribute names, however, it's easily done when the name is contained in a variable. The only limitation seems to be that an attribute cannot start with NULL. Since it's "allowed," then PHP should fully support its effects. Reproduce code: --------------- <?php $c = new stdClass; $a = "HIDDEN\000-TEXT"; $c->$a = 'foo'; print_r($c); ?> Expected result: ---------------- stdClass Object ( ["HIDDEN\000-TEXT"] => foo ) Actual result: -------------- stdClass Object ( [HIDDEN] => foo ) -- Edit bug report at http://bugs.php.net/?id=41592&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41592&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41592&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41592&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41592&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41592&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41592&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41592&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41592&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41592&r=support Expected behavior: http://bugs.php.net/fix.php?id=41592&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41592&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41592&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41592&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41592&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41592&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41592&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41592&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41592&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41592&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41592&r=mysqlcfg

« previous php.bugs (#113371) next »