ID:               26401
 Updated by:       [EMAIL PROTECTED]
 Reported By:      bernhard at rainbow dot bksys dot at
-Status:           Open
+Status:           Bogus
 Bug Type:         Arrays related
 Operating System: debian sarge
 PHP Version:      4.3.2
 New Comment:

Install 4.3.4, set register_globals=off and error_reporting=E_ALL in
your php.ini..

And RTFM.



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

[2003-11-25 06:41:09] bernhard at rainbow dot bksys dot at

Description:
------------
http://bksys.at/bernhard/phpbug.php?data=123

Only with the URL parameter data set to something,

$data[0] is the first character of the element last inserted
into the array $data[]

and $data[1++) yields the characters of $_REQUEST['data'][1++].

Though I have PHP 4.1.2, this also happened on PHP 4.3.2.



Reproduce code:
---------------
<html><body>
<?php
/*
why does this script print the first character of
$data['foo'] if called with the url parameter
data set to something, e.g. .../test.php?data=123
A bug?

*/

$data['dummy']='nothing';
$data['foo']='bar';
echo '[',$data[null],']';
echo '[',$data[''],']';
echo '[',$data[0],']';
echo '[',$data[1],']';
echo '[',$data[2],']';
echo '[',$data[3],']';
echo '[',$data[-1],']';
echo '[',$data[-2],']';

echo "<pre>";
echo htmlspecialchars(implode('',file($_SERVER['SCRIPT_FILENAME'])));
echo "</pre>";
phpinfo();
?>
</body></html>


Expected result:
----------------
[][][][][][][][]

<html><body>
<?php
/*
why does this script print the first character of
$data['foo'] if called with the url parameter
data set to something, e.g. .../test.php?data=123
A bug?

*/

$data['dummy']='nothing';
$data['foo']='bar';
echo '[',$data[null],']';
echo '[',$data[''],']';
echo '[',$data[0],']';
echo '[',$data[1],']';
echo '[',$data[2],']';
echo '[',$data[3],']';
echo '[',$data[-1],']';
echo '[',$data[-2],']';

echo "<pre>";
echo htmlspecialchars(implode('',file($_SERVER['SCRIPT_FILENAME'])));
echo "</pre>";
phpinfo();
?>
</body></html>

PHP Logo
PHP Version 4.1.2

Actual result:
--------------
[b][b][b][2][3][][][]

<html><body>
<?php
/*
why does this script print the first character of
$data['foo'] if called with the url parameter
data set to something, e.g. .../test.php?data=123
A bug?

*/

$data['dummy']='nothing';
$data['foo']='bar';
echo '[',$data[null],']';
echo '[',$data[''],']';
echo '[',$data[0],']';
echo '[',$data[1],']';
echo '[',$data[2],']';
echo '[',$data[3],']';
echo '[',$data[-1],']';
echo '[',$data[-2],']';

echo "<pre>";
echo htmlspecialchars(implode('',file($_SERVER['SCRIPT_FILENAME'])));
echo "</pre>";
phpinfo();
?>
</body></html>

PHP Logo
PHP Version 4.1.2


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


-- 
Edit this bug report at http://bugs.php.net/?id=26401&edit=1

Reply via email to