#29271 [Bgs]: behaviour of $string['text'] = 'new string';
ID: 29271 User updated by: nospam0 at malkusch dot de Reported By: nospam0 at malkusch dot de Status: Bogus Bug Type: Strings related Operating System: * PHP Version: 5.0.0 New Comment: It's expected behaviour: 'index' is casted to it's integer value (0), that's why you get this result. But as I use $string[] and not $string{} it's undefined wether it should be a new array or a string. So why doesn't PHP throw an error? Previous Comments: [2004-07-28 12:39:59] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php It's expected behaviour: 'index' is casted to it's integer value (0), that's why you get this result. [2004-07-20 01:54:22] nospam0 at malkusch dot de Description: $string = 'a bla'; $string['index'] = 'b blub'; does the same work as $string = 'a bla'; $string{(int)'index'} = 'b blub'{0}; without any notic of undefined index or too long replacing string. But it should throw any notice, because one could expect that the code should produce a new Array('index' = 'b blubb'). Reproduce code: --- $string = 'a bla'; $string['index'] = 'b blub'; var_dump($string); Expected result: Either notices for use of deprecated [], undefined offset 'index' and too long replace char (and of course the actual result) or 'a bla' is deleted and $string has array('index' = 'b blubb') as value. Actual result: -- string(5) b bla -- Edit this bug report at http://bugs.php.net/?id=29271edit=1
#29271 [Bgs]: behaviour of $string['text'] = 'new string';
ID: 29271 Updated by: [EMAIL PROTECTED] Reported By: nospam0 at malkusch dot de Status: Bogus Bug Type: Strings related Operating System: * PHP Version: 5.0.0 New Comment: $string already IS a string and you still can use array-brackets to access a particular symbol, so it won't become an array. Previous Comments: [2004-07-28 13:15:34] nospam0 at malkusch dot de It's expected behaviour: 'index' is casted to it's integer value (0), that's why you get this result. But as I use $string[] and not $string{} it's undefined wether it should be a new array or a string. So why doesn't PHP throw an error? [2004-07-28 12:39:59] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php It's expected behaviour: 'index' is casted to it's integer value (0), that's why you get this result. [2004-07-20 01:54:22] nospam0 at malkusch dot de Description: $string = 'a bla'; $string['index'] = 'b blub'; does the same work as $string = 'a bla'; $string{(int)'index'} = 'b blub'{0}; without any notic of undefined index or too long replacing string. But it should throw any notice, because one could expect that the code should produce a new Array('index' = 'b blubb'). Reproduce code: --- $string = 'a bla'; $string['index'] = 'b blub'; var_dump($string); Expected result: Either notices for use of deprecated [], undefined offset 'index' and too long replace char (and of course the actual result) or 'a bla' is deleted and $string has array('index' = 'b blubb') as value. Actual result: -- string(5) b bla -- Edit this bug report at http://bugs.php.net/?id=29271edit=1
#29271 [Bgs]: behaviour of $string['text'] = 'new string';
ID: 29271 User updated by: nospam0 at malkusch dot de Reported By: nospam0 at malkusch dot de Status: Bogus Bug Type: Strings related Operating System: * PHP Version: 5.0.0 New Comment: $string already IS a string and you still can use array-brackets to access a particular symbol So PHP will never throw an error, even [] on strings is deprecated since PHP4? Previous Comments: [2004-07-28 13:25:55] [EMAIL PROTECTED] $string already IS a string and you still can use array-brackets to access a particular symbol, so it won't become an array. [2004-07-28 13:15:34] nospam0 at malkusch dot de It's expected behaviour: 'index' is casted to it's integer value (0), that's why you get this result. But as I use $string[] and not $string{} it's undefined wether it should be a new array or a string. So why doesn't PHP throw an error? [2004-07-28 12:39:59] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php It's expected behaviour: 'index' is casted to it's integer value (0), that's why you get this result. [2004-07-20 01:54:22] nospam0 at malkusch dot de Description: $string = 'a bla'; $string['index'] = 'b blub'; does the same work as $string = 'a bla'; $string{(int)'index'} = 'b blub'{0}; without any notic of undefined index or too long replacing string. But it should throw any notice, because one could expect that the code should produce a new Array('index' = 'b blubb'). Reproduce code: --- $string = 'a bla'; $string['index'] = 'b blub'; var_dump($string); Expected result: Either notices for use of deprecated [], undefined offset 'index' and too long replace char (and of course the actual result) or 'a bla' is deleted and $string has array('index' = 'b blubb') as value. Actual result: -- string(5) b bla -- Edit this bug report at http://bugs.php.net/?id=29271edit=1