From:             aulbach at ssilk dot de
Operating system: linux
PHP version:      4.3.7
PHP Bug Type:     Arrays related
Bug description:  Extremly unuseful behavior of $string[index]-feature

Description:
------------
The following code produces this result:

a2345

This behaviour is not very useful, because this kind of error is extremly
difficult to find.



Reproduce code:
---------------
<?php
$in=array(
    'params' => 'action=bla',
    'action' => '',
    );
$params="12345";
// by error $params is a string
// instead of array or empty

$params['action'[EMAIL PROTECTED]'params'];
// and the following 2000 lines
// of code is able to handle $params either
// as array OR string (e. g.
// cause of backward compatibility to
// further versions of $in)

print_r($params);
?>

Expected result:
----------------
One (or more) of these

* an array (
[0] => 12345
[action] => action=bla
)

* if this result above, a warning message
'String is automagically converted to array, line 8'

* an error message
'A string cannot indiced via string-type, use integer only, line 8'

* a warning message
'Use of [] while indexing a string is depricated, use {}, line 8'

* an error message
'Use of [] while indexing a string is not longer allowed, use {} instead,
line 8'


Actual result:
--------------
a2345


-- 
Edit bug report at http://bugs.php.net/?id=28917&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28917&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28917&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28917&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28917&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28917&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28917&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28917&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28917&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28917&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28917&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28917&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28917&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28917&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28917&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28917&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28917&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28917&r=float

Reply via email to