[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-internals
Subject:    Re: [PHP-DEV] Bug in pcre (pcre.backtrack_limit)?
From:       "David Coallier" <davidc () php ! net>
Date:       2008-01-30 21:33:07
Message-ID: b5f7bf6c0801301333m75731115vb3f001a8707d54a8 () mail ! gmail ! com
[Download RAW message or body]

On Jan 30, 2008 4:03 PM, Karl Pflästerer <k@rl.pflaesterer.de> wrote:
> Felipe Pena <felipensp@gmail.com> writes:
>
> > Hello
> >
> > Em Qua, 2008-01-30 às 20:57 +0100, Karl Pflästerer escreveu:
> >> Hi,
> >> when pcre.backtrack_limit is reached with preg_replace() the subject
> >> string gets truncated to a string of length zero.
> >
> > I changed the phrase about the return value (3 weeks ago) in
> > pcre_replace(), it can be seen at http://docs.php.net/preg-replace, i
> > added "or NULL if an error occurred."
> >
> > <?php
> > ini_set("pcre.backtrack_limit",10);
> > $s = str_repeat("a", 9999);
> > var_dump(preg_replace("/a(.*?)b/", "\$1", $s));
> > var_dump(preg_last_error()); // 2 = PREG_BACKTRACK_LIMIT_ERROR
> >
> > Output:
> > NULL
> > int(2)
>
> Thanks for the explanation; sadly your addition can only be found at
> docs.php.net not for example at
> www.php.net/manual/en/function.preg-replace.php which was until now my
> first choice if i wanted to look something up in the docs.
>

For future information Karl, http://docs.php.net is the main
documentation server. Everything else are mirrors and those will be
regenerated around the release of php 5.3 (Not now..)

:)

> IMO this is the wrong behaviour but it's at least documented :-)
>
>
> KP
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
David Coallier,
Founder & Software Architect,
Agora Production (http://agoraproduction.com)
51.42.06.70.18

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic