# PCRE error handling patch

- Thread: https://externals.io/message/22714
- Original archive: https://news-web.php.net/php.internals/22714
- Started by Andrei Zmievski on 2006-04-11T18:25:31+00:00
- Messages: 12
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #22714 — Andrei Zmievski — 2006-04-11T18:25:31+00:00

URL: https://externals.io/message/22714#22714

I made a patch (against HEAD currently only) that makes it possible to 
set runtime limits on backtracking and recursion. It also implements 
 `preg_last_error()` that lets users check whether there was an execution 
error (such as limit exceeded or bad UTF-8 or whatever).

Ilia, do you think it might make it into 5.1.3?

http://www.php.net/~andrei/pcre.diff

-Andrei

---

## #22716 — Jani Taskinen — 2006-04-11T18:35:07+00:00

URL: https://externals.io/message/22714#22716 · In reply to: #22714

Sounds to me like a bug fix..all those recursion bugs in the db.. :)

     --Jani



> I made a patch (against HEAD currently only) that makes it possible to set 
> runtime limits on backtracking and recursion. It also implements 
> `preg_last_error()` that lets users check whether there was an execution error 
> (such as limit exceeded or bad UTF-8 or whatever).
>
> Ilia, do you think it might make it into 5.1.3?
>
> http://www.php.net/~andrei/pcre.diff
>
> -Andrei

---

## #22717 — Nuno Lopes — 2006-04-11T18:51:43+00:00

URL: https://externals.io/message/22714#22717 · In reply to: #22714

I would say that 100.000 recursions is too much. When I made my patch it was 
segfaulting with such value. 50.000 is a much safer choice (at least on my 
gentoo box, 8 MB of stack).

Nuno


----- Original Message ----- 
>I made a patch (against HEAD currently only) that makes it possible to set 
>runtime limits on backtracking and recursion. It also implements 
>preg_last_error() that lets users check whether there was an execution 
>error (such as limit exceeded or bad UTF-8 or whatever).
>
> Ilia, do you think it might make it into 5.1.3?
>
> http://www.php.net/~andrei/pcre.diff
>
> -Andrei

---

## #22718 — Andrei Zmievski — 2006-04-11T19:25:29+00:00

URL: https://externals.io/message/22714#22718 · In reply to: #22717

It's hard to pick a default that will work for everyone. I can probably 
see setting recursion limit somewhat lower than backtracking one, 
though. Maybe 100,000/50,000 or something like that.

-Andrei



> I would say that 100.000 recursions is too much. When I made my patch 
> it was segfaulting with such value. 50.000 is a much safer choice (at 
> least on my gentoo box, 8 MB of stack).
>
> Nuno
>
>
> ----- Original Message -----
> > […]

---

## #22733 — Ilia Alshanetsky — 2006-04-12T13:05:38+00:00

URL: https://externals.io/message/22714#22733 · In reply to: #22714

No, lets wait with it till the next PHP 5 release.

Ilia




> I made a patch (against HEAD currently only) that makes it possible  
> to set runtime limits on backtracking and recursion. It also  
> implements `preg_last_error()` that lets users check whether there  
> was an execution error (such as limit exceeded or bad UTF-8 or  
> whatever).
>
> Ilia, do you think it might make it into 5.1.3?
>
> http://www.php.net/~andrei/pcre.diff
>
> -Andrei

---

## #22720 — Andrei Zmievski — 2006-04-12T16:07:22+00:00

URL: https://externals.io/message/22714#22720 · In reply to: #22733

5.1.4?

-Andrei




> No, lets wait with it till the next PHP 5 release.
>
> Ilia
>
>
> 
>
> > […]

---

## #22721 — Lukas Smith — 2006-04-12T16:17:13+00:00

URL: https://externals.io/message/22714#22721 · In reply to: #22720

Andrei Zmievski wrote:
> 5.1.4?

I have the following items as future todos:

    1.  new functions: ext/date: date_sun_info (derick)
    2. Switch for disabling/enabling materialized cursors in mysqli (georg)
    3. fix __toString() (marcus)
    4. add support for files >2GB (wez)
    5. Add input filter extension via a symlink from pecl into core as 
experimental (derick)
    6. Add json extension via a symlink from pecl into core as experimental
    7. add PDO::defaultFetchMode attribute (pierre)
    8. PCRE: make it possible to set runtime limits on backtracking and 
recursion and add `preg_last_error()`

Especially for Nr. 3 I guess we would have to move to 5.2.
That is why I would favor 5.2 over 5.1.4 and reserve 5.1.4 to a quick 
security fix release if one becomes necessary.

regards,
Lukas

---

## #22722 — Jani Taskinen — 2006-04-12T16:48:27+00:00

URL: https://externals.io/message/22714#22722 · In reply to: #22721

> Andrei Zmievski wrote:
> > […]
>
> I have the following items as future todos:
>
>   1.  new functions: ext/date: date_sun_info (derick)
>   2. Switch for disabling/enabling materialized cursors in mysqli (georg)
>   3. fix __toString() (marcus)

     Wasn't that fixed already? Or was that just in HEAD?

>   4. add support for files >2GB (wez)
>   5. Add input filter extension via a symlink from pecl into core as 
> experimental (derick)
>   6. Add json extension via a symlink from pecl into core as experimental
>   7. add PDO::defaultFetchMode attribute (pierre)
>   8. PCRE: make it possible to set runtime limits on backtracking and 
> recursion and add `preg_last_error()`
>
> Especially for Nr. 3 I guess we would have to move to 5.2.
> That is why I would favor 5.2 over 5.1.4 and reserve 5.1.4 to a quick security 
> fix release if one becomes necessary.

     I could not agree more. +1 for 5.2. We can't wait for 6.0 forever to get
     some new features in. It's still at least year from now til it's release
     I bet.

     --Jani

---

## #22723 — Andrei Zmievski — 2006-04-12T18:01:41+00:00

URL: https://externals.io/message/22714#22723 · In reply to: #22722

The problem is that with 5.2 you'll get all kinds of old threads 
resurrected, because people think that it's time to add some new 
features.. Like namespaces.

-Andrei



>     I could not agree more. +1 for 5.2. We can't wait for 6.0 forever 
> to get
>     some new features in. It's still at least year from now til it's 
> release
>     I bet.

---

## #22724 — Jani Taskinen — 2006-04-12T18:56:06+00:00

URL: https://externals.io/message/22714#22724 · In reply to: #22723

I have this thing called "delete" in my MUA which I can use to get rid
     of unwanted noise. :)

     --Jani




> The problem is that with 5.2 you'll get all kinds of old threads resurrected, 
> because people think that it's time to add some new features.. Like 
> namespaces.
>
> -Andrei
>
> 
>
> > […]
>
>

-- 
Give me your money at @ <http://pecl.php.net/wishlist.php/sniper>
Donating money may make me happier and friendlier for a limited period!
Death to all 4 letter abbreviations starting with P!

---

## #22725 — Marcus Boerger — 2006-04-12T19:40:11+00:00

URL: https://externals.io/message/22714#22725 · In reply to: #22723

Hello Andrei,

  no namespaces in 5.2 (.) that is for head.

Wednesday, April 12, 2006, 8:01:41 PM, you wrote:

> The problem is that with 5.2 you'll get all kinds of old threads 
> resurrected, because people think that it's time to add some new 
> features.. Like namespaces.

> -Andrei

> 

> > […]




Best regards,
 Marcus

---

## #22726 — Marcus Boerger — 2006-04-12T19:41:59+00:00

URL: https://externals.io/message/22714#22726 · In reply to: #22721

Hello Lukas,

Wednesday, April 12, 2006, 6:17:13 PM, you wrote:

> Andrei Zmievski wrote:
> > […]

> I have the following items as future todos:

>     1.  new functions: ext/date: date_sun_info (derick)
>     2. Switch for disabling/enabling materialized cursors in mysqli (georg)
>     3. fix __toString() (marcus)
fixed in head, will be in 5.2
>     4. add support for files >2GB (wez)
>     5. Add input filter extension via a symlink from pecl into core as 
> experimental (derick)
>     6. Add json extension via a symlink from pecl into core as experimental
>     7. add PDO::defaultFetchMode attribute (pierre)
s/pierre/marcus/; fixed in head will be in 5.2
>     8. PCRE: make it possible to set runtime limits on backtracking and 
> recursion and add `preg_last_error()`

Most of the other stuff is either bigger feature additions or requires api
changes so i'd say all of them in 5.2.

regards
marcus
