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

 ID:               51663
 Updated by:       [email protected]
 Reported by:      jordi dot salvat dot i dot alabart at gmail dot com
 Summary:          PHP preg_match doesn't match string which should match
-Status:           Open
+Status:           Bogus
 Type:             Bug
 Package:          PCRE related
 Operating System: Ubuntu
 PHP Version:      5.3.2

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Change the pcre.backtrack_limit directive value. [1]



Tested on 5.3SVN:

<?php



printf("pcre.backtrack_limit = %d\n", ini_get('pcre.backtrack_limit'));

var_dump(preg_match("/(.+)+:/", "a:bbbbbbbbbbbbb")); // 0

var_dump(preg_last_error()); // 2 (i.e. PREG_BACKTRACK_LIMIT_ERROR)



ini_set('pcre.backtrack_limit', 1000000);

printf("pcre.backtrack_limit = %d\n", ini_get('pcre.backtrack_limit'));

var_dump(preg_match("/(.+)+:/", "a:bbbbbbbbbbbbb")); // 1

var_dump(preg_last_error()); // 0



[1] http://docs.php.net/manual/en/pcre.configuration.php


Previous Comments:
------------------------------------------------------------------------
[2010-04-28 17:48:13] jordi dot salvat dot i dot alabart at gmail dot
com

No, I didn't try it myself. A colleague (Diego Campoy) with more time
available downloaded, compiled, and tested my first steps-to-reproduce
in 5.3.2, thus confirming the bug.



Diego confirms that he tested with the bundled PCRE library, version
7.8.

------------------------------------------------------------------------
[2010-04-28 11:45:56] [email protected]

Only to be sure:



did you actually try using 5.3.2 and the bundled PCRE? You can test it
without having to install PHP on your system. You only have to compile
php. The same applies for php 5.2.13.

------------------------------------------------------------------------
[2010-04-28 11:31:07] adconrad at ubuntu dot com

Given that Ubuntu builds PHP against the system libpcre, and pcretest
(by definition, but also a quick visual check with ldd) also uses the
system libpcre, it seems unlikely this is a problem with libpcre itself,
since pcretest works and PHP doesn't.

------------------------------------------------------------------------
[2010-04-26 12:18:53] [email protected]

Are you using the bundled PCRE lib or your system's one? - Default is
the bundled one. currently bundled is 8.02. i assume  this is  a PCRE
and no PHP issue.

------------------------------------------------------------------------
[2010-04-26 00:52:55] jordi dot salvat dot i dot alabart at gmail dot
com

I've been able to simplify the example to:



<?= preg_match("/(.+)+:/", "a:bbbbbbbbbbbbb") ? "pass" : "fail" ?>



(I've checked this simplified form fails in PHP 5.2.10-2ubuntu6.4;
checking it in 5.3.2 too is left as an exercise for the reader).

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=51663


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

Reply via email to