|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-03-23 14:23 UTC] 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 20:00:01 2025 UTC |
The erros is with $out, not $outjs. Then, put the var_dump($out); before the line: while ($out[0][$ile] != 0) {