#44512 [Opn->Bgs]: Cannot use string offset as an array
| From: | felipe@php.net | Date: | Sun, 23 Mar 2008 14:56:33 +0000 |
| Subject: | #44512 [Opn->Bgs]: Cannot use string offset as an array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-123562@lists.php.net to get a copy of this message | ||
ID: 44512
Updated by: felipe@php.net
Reported By: gogulas at wp dot pl
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: WIndows Xp SP3
PHP Version: 5.2CVS-2008-03-23 (CVS)
New Comment:
The erros is with $out, not $outjs.
Then, put the var_dump($out); before the line: while ($out[0][$ile] !=
0) {
Previous Comments:
------------------------------------------------------------------------
[2008-03-23 14:23:16] gogulas at wp dot pl
Description:
------------
Hello,
here is script which egenerate error:
"Cannot use string offset as an array"
in line "while ($out[0][$ile] != 0){"
when i uncoment:
//echo "ok";
//exit;
the script gonna ignore problem and echo "ok"...
//var_dump ($outjs);
print a normal array, everything seems to be good, plase explain that,
IMO this is a bug, thank you.
Reproduce code:
---------------
This is just a part of code, source of script are getable here:
http://gogulas.yoyo.pl/array_bug_script.txt
<?php
(...)
preg_match_all("/(.)=(.);/", $dane, $outjs, PREG_PATTERN_ORDER);
preg_match_all("/([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})<script
type=\"text\/javascript\">document.write\(\":\"(.*?)\)<\/script>/",
$dane, $out, PREG_PATTERN_ORDER);
fclose($fp);
$ile = "0";
while ($out[0][$ile] != 0){
$out[5][$ile] = str_replace("+", "", $out[5][$ile]);
$ilejs = "0";
//echo "<pre>";
//var_dump ($outjs);
//echo "</pre>";
//exit;
while ( $outjs[2][$ilejs] > 0 ){
//echo "ok";
//exit;
$out[5][$ile] = str_replace($outjs[1][$ilejs], $outjs[2][$ilejs],
$out[5][$ile]);
echo "ok";
exit;
$ilejs++;}
(...) ?>
Expected result:
----------------
I expected that the script gonna work fine.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44512&edit=1