Bug #15737 Updated: isset() dont work with $str[$index]

From: Date: Tue, 26 Feb 2002 19:03:06 +0000
Subject: Bug #15737 Updated: isset() dont work with $str[$index]
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-1108@lists.php.net to get a copy of this message
ID: 15737 Updated by: zak@php.net Reported By: Beater@orgalan.de -Status: Open +Status: Bogus -Bug Type: Compile Warning +Bug Type: Strings related Operating System: Win32 / Linux PHP Version: 4.1.1 New Comment: The issues is not isset(). PHP generates an warning when attempting to access a string subscript that does not exist. If the level error reporting is set to E_ALL, this warning will be generated. A better way to do this would be to use strlen(). Previous Comments: ------------------------------------------------------------------------ [2002-02-26 13:52:05] Beater@orgalan.de <?php function test($foo = 'bar') { for($i=0; $i<5; $i++) { !isset($foo[$i]) ? $foo[$i] = 0 : 0; echo $foo[$i]; } } test(); ?> works fine on 4.0.6; 4.1.1 (linux and win32) announces "Uninitialized string offset on line 6..." ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=15737&edit=1

« previous php.bugs (#1108) next »