#47278 [Opn->Bgs]: preg_match behaves different to version 4.4.4

From: Date: Mon, 02 Feb 2009 23:23:55 +0000
Subject: #47278 [Opn->Bgs]: preg_match behaves different to version 4.4.4
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-133405@lists.php.net to get a copy of this message
 ID:               47278
 Updated by:       jani@php.net
 Reported By:      franklyn dot santana at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         PCRE related
 Operating System: Windows 2003 Server
 PHP Version:      5.2.8
 New Comment:

Hint: PREG_BACKTRACK_LIMIT_ERROR




Previous Comments:
------------------------------------------------------------------------

[2009-02-02 20:46:12] felipe@php.net

Check preg_last_error().
http://docs.php.net/manual/en/function.preg-last-error.php

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

[2009-02-02 20:30:13] franklyn dot santana at gmail dot com

I read somewhere (right now I don't remember where) there is problem
with long regular expressions in php5. Is that true? I made the regular
expression shorter, now the script works (with some limitations due to
the short regex).

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

[2009-02-02 13:44:58] franklyn dot santana at gmail dot com

Description:
------------
I have a code for url rewrite, I use the preg_match function to
separate the GET parameters.

The code works fine in PHP 4.4.4, I get a matches array with the GET
parameters. But it doesn't work on PHP 5.28, the matches array is
empty.

I was checking the documentation and It seems there are not changes on
this function. 

Reproduce code:
---------------
$url="http://localhost/test+param-2009.html";

preg_match("/\/[^+]*\+?[^+]+\++([^-]*)-?([^-]*)-?([^-]*)-?([^-]*)-?([^-]*)-?".
"([^-]*)-?([^-]*)-?([^-]*)-?([^-]*)-?([^-]*)-?([^-]*)-?([^-]*)-?([^-]*)-?([^-]*)-?".
"([^-]*)-?([^-]*)-?([^-]*)-?([^-]*)-?([^-]*)-?([^-]*)\.html/i", $url,
$parameters);

 print_r($parameters)


Expected result:
----------------
/*tested on PHP 4.4.4
Array ( [0] => //localhost/test+param-2009.html [1] => param [2] =>
2009 [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] =>
[12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => [20] =>
) 

Actual result:
--------------
Array ( ) 


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


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



Thread (5 messages)

« previous php.bugs (#133405) next »