#49539 [Opn->Bgs]: {08} and {09} behave like {00}

From: Date: Sun, 13 Sep 2009 04:00:02 +0000
Subject: #49539 [Opn->Bgs]: {08} and {09} behave like {00}
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-142291@lists.php.net to get a copy of this message
ID: 49539 Updated by: rasmus@php.net Reported By: info at daniel-marschall dot de -Status: Open +Status: Bogus Bug Type: *General Issues Operating System: Linux PHP Version: 5.2.0 New Comment: You have discovered octal numbers. There is no 08 and 09 in octal. Previous Comments: ------------------------------------------------------------------------ [2009-09-13 03:51:55] info at daniel-marschall dot de (I mean "IIJJ", of course.) ------------------------------------------------------------------------ [2009-09-13 03:50:26] info at daniel-marschall dot de Description: ------------ I believe I found an error in PHP 5.2.0-8+etch15 (cli) <?php $quad = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; echo $quad{8}; // I echo $quad{08}; // A <- ERROR echo $quad{9}; // K echo $quad{09}; // A <- ERROR ?> The other values {00} to {07} are working as expected. Why doesn'T {08} and {09} work? They should behave like {8} and {9} since 08 == 8 and 09 == 9. Reproduce code: --------------- <?php $quad = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; echo $quad{8}; // I echo $quad{08}; // A <- ERROR echo $quad{9}; // K echo $quad{09}; // A <- ERROR ?> Expected result: ---------------- Output: IIKK Actual result: -------------- Output: IAKA ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49539&edit=1

« previous php.bugs (#142291) next »