ID:               29271
 Comment by:       m dot ford at leedsmet dot ac dot uk
 Reported By:      nospam0 at malkusch dot de
 Status:           Bogus
 Bug Type:         Strings related
 Operating System: *
 PHP Version:      5.0.0
 New Comment:

Why should it?  It's only deprecated, not obsolete -- and there's not
even a hint of a date being scheduled for its withdrawal.

(Deprecated meaning, roughly, not encouraged and may be withdrawn one
day, maybe, if the php gurus ever get around to it.)

As withdrawal of this feature hasn't been announced yet, I think you
can take it it'll probably be around at least for the lifetime of PHP 5
-- but the use of {} instead of [] is strongly encouraged.

Cheers!

Mike


Previous Comments:
------------------------------------------------------------------------

[2004-07-28 13:49:59] nospam0 at malkusch dot de

> $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?

------------------------------------------------------------------------

[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=29271&edit=1

Reply via email to