Bug #72824 [NEW]: substr length of 08 or 09 fails (8 or 9 return valid results)

From: Date: Fri, 12 Aug 2016 20:58:45 +0000
Subject: Bug #72824 [NEW]: substr length of 08 or 09 fails (8 or 9 return valid results)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203224@lists.php.net to get a copy of this message
From: crsthorn at gmail dot com Operating system: Linux PHP version: Irrelevant Package: Strings related Bug Type: Bug Bug description:substr length of 08 or 09 fails (8 or 9 return valid results) Description: ------------ PHP 5.5.9-1ubuntu4.17 (cli) (built: May 19 2016 19:05:57) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies ==================================================================== This was also present in PHP 5.3.X versions When calling the substr function and passing it a length of 08 or 09 - it seems to return a null. Passing lengths of 8 or 9 return expected results. Test script: --------------- <?PHP $buffer = "This should work as expected."; echo substr($buffer , 0 , 1) ."\n"; echo substr($buffer , 0 , 01) ."\n"; echo substr($buffer , 0 , 7) ."\n"; echo substr($buffer , 0 , 07) ."\n"; echo substr($buffer , 0 , 8) ."\n"; echo substr($buffer , 0 , 08) ."\n"; //FAILS echo substr($buffer , 0 , 9) ."\n"; echo substr($buffer , 0 , 09) ."\n"; //FAILS echo substr($buffer , 0 , 10) ."\n"; echo substr($buffer , 0 , 10) ."\n"; ?> -- Edit bug report at https://bugs.php.net/bug.php?id=72824&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72824&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72824&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72824&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=72824&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=72824&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=72824&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=72824&r=needscript Try newer version: https://bugs.php.net/fix.php?id=72824&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=72824&r=support Expected behavior: https://bugs.php.net/fix.php?id=72824&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=72824&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=72824&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=72824&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72824&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=72824&r=dst IIS Stability: https://bugs.php.net/fix.php?id=72824&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=72824&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=72824&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=72824&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=72824&r=mysqlcfg

« previous php.bugs (#203224) next »