#44808 [NEW]: Accessing string offsets (array notation)

From: Date: Wed, 23 Apr 2008 14:11:18 +0000
Subject: #44808 [NEW]: Accessing string offsets (array notation)
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-740@lists.php.net to get a copy of this message
From: florian dot ember at gmail dot com Operating system: Windows XP PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Accessing string offsets (array notation) Description: ------------ While messing around with the feature mentioned in the summary, I came across some undocumented results and/or bugs which should be documented (or fixed respectively). Offsets - When using an out of range offset, the string is padded with spaces. - When using a floating point number as offset, it is *always* rounded down. - When using an illegal type (such as an array) as offset, a warning is emitted and 0 is assumed. - When using a negative offset, PHP reports an uninitialized offset in read context, but reports an illegal offset in write context. Insert strings - When using a string which length is greater than 1, only the first character is used. (Fairly obvious but not documented) - When using a string which length is 0 ("", that is), a \0 character is inserted at that position instead. The last result is the strangest one. Might be a bug. -- Edit bug report at http://bugs.php.net/?id=44808&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44808&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44808&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44808&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44808&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44808&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44808&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44808&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44808&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44808&r=support Expected behavior: http://bugs.php.net/fix.php?id=44808&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44808&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44808&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44808&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44808&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44808&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44808&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44808&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44808&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44808&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44808&r=mysqlcfg

« previous php.doc.bugs (#740) next »