php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53955 preg_match_all missing results
Submitted: 2011-02-08 09:06 UTC Modified: 2013-02-18 00:34 UTC
From: rick at lavoo dot com Assigned:
Status: No Feedback Package: *Regular Expressions
PHP Version: 5.3.5 OS: FreeBSD 7.2-RELEASE
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-02-08 09:06 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-02-08 09:10 UTC] rasmus@php.net
-Status: Open +Status: Feedback
 [2011-02-08 09:10 UTC] rasmus@php.net
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.
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Nov 30 22:03:36 2021 UTC