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

 ID:                 53955
 Updated by:         ras...@php.net
 Reported by:        rick at lavoo dot com
 Summary:            preg_match_all missing results
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            *Regular Expressions
 Operating System:   FreeBSD 7.2-RELEASE
 PHP Version:        5.3.5
 Block user comment: N
 Private report:     N

 New Comment:

Without a test script we can actually run, we have no way of checking if
this is 

actually a bug.



Simplify the script down to a smaller set of documents, embed them in a
standalone 

script that we can download somewhere, and we can have a look.


Previous Comments:
------------------------------------------------------------------------
[2011-02-08 09:06:08] rick at lavoo dot com

Description:
------------
phpinfo(); http://corgfx.com/info.php



preg_match_all is missing valid results while running in a loop of
documents. There are 12 valid matches per document, but starting from
document 5 only 11 results are returned. When the script is run "only"
on document 5 or 6 or 7 etc, all 12 results are returned properly.



The script returns no warnings or errors when running in the loop and
missing the 12th result.

Test script:
---------------
This is an example of the code being used:



    for ($i = 0; $i <= $pages; $i++) {

        shell_exec(" /usr/local/bin/curl -o /tmp/coffee_process_ajax.tmp
-b PHPSESSID=$cookie -d \"category_id=$cat&page_index=$i\"
http://www..........com/html/results_ajax.php";);

        $filename = "/tmp/coffee_process_ajax.tmp";

        $handle = fopen($filename, "r");

        $adata = fread($handle, filesize($filename));

        fclose($handle);

        preg_match_all("/<table class=AssetContent>(.*?)<\/table>/",
str_replace("\n","",$adata), $ajarray);

        $saveThis[]=$ajarray[0];

    }

Expected result:
----------------
The expected result is all 12 results to be returned with and without
the loop.

Actual result:
--------------
Returns only 11 results starting at $page=4 (the 5th document) while
running in the loop. Returns all 12 results for $page=4 when not running
in the loop.


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



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

Reply via email to