From:             gogulas at wp dot pl
Operating system: WIndows Xp SP3
PHP version:      5.2CVS-2008-03-23 (CVS)
PHP Bug Type:     Arrays related
Bug description:  Cannot use string offset as an array

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 bug report at http://bugs.php.net/?id=44512&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=44512&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=44512&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=44512&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44512&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=44512&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44512&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44512&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44512&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44512&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44512&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=44512&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=44512&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44512&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44512&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44512&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44512&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44512&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44512&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44512&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44512&r=mysqlcfg

Reply via email to