Bug #14304 Updated: Potential problem with regex...

From: Date: Wed, 02 Jan 2002 19:05:04 +0000
Subject: Bug #14304 Updated: Potential problem with regex...
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-75654@lists.php.net to get a copy of this message
ID: 14304
Updated by: lobbin
Reported By: bajolet@toiletoine.net
Old Status: Feedback
Status: Closed
Bug Type: Regexps related
Operating System: Linux php3-2 2.4.7 #1 Thu Aug 9
PHP Version: 4.0.6
New Comment:

No feedback. Closing.

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

[2001-12-12 01:41:11] zak@php.net

I cannot reproduce the problem under PHP 4.1.0. Can you 
upgrade to this version?


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

[2001-12-12 01:31:01] bajolet@toiletoine.net

The problem is there...
I got the first result :

>array(10) {
>  [0]=>
>  string(24) "<phpdig:ignore_message/>"
>  [1]=>
>  string(14) "ignore_message"
>  [2]=>
>  ...

But on the second, i got nothing but a 'maximum execution time exceeded'.
I traced my code with some echoes and flush(), and it seems that the php engine stays on the eregi()
function.
It not core dump, but Apache goes 100% CPU until the timeout occurs.

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

[2001-12-11 17:39:59] zak@php.net

Thanks for the additional information.

I tested the code snippets provided on PHP 4.1.0 - they 
all seem to operate as expected. The input of both 
snippets (when fed to your original function) returns 
'<br><i></i></td>'

The regular expressions provided later seem to work as 
well.

The top snippet captures:

array(10) {
  [0]=>
  string(24) "<phpdig:ignore_message/>"
  [1]=>
  string(14) "ignore_message"
  [2]=>
  bool(false)
  [3]=>
  bool(false)
  [4]=>
  bool(false)
  [5]=>
  bool(false)
  [6]=>
  bool(false)
  [7]=>
  bool(false)
  [8]=>
  bool(false)
  [9]=>
  bool(false)
}

...and the bottom snippet captures:

array(10) {
  [0]=>
  string(31) "<phpdig:ignore_common_message/>"
  [1]=>
  string(21) "ignore_common_message"
  [2]=>
  bool(false)
  [3]=>
  bool(false)
  [4]=>
  bool(false)
  [5]=>
  bool(false)
  [6]=>
  bool(false)
  [7]=>
  bool(false)
  [8]=>
  bool(false)
  [9]=>
  bool(false)
}

Is this the output that you get with PHP 4.0.6? Please let 
me know!




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

[2001-12-09 08:08:18] bajolet@toiletoine.net

Changed bug type to Regexps

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

[2001-12-09 08:00:37] bajolet@toiletoine.net

I isolate the bug :
this works :

eregi('<phpdig:([a-z0-9_]*)[[:blank:]]*(src=)*["\']*([a-z0-9./_-]+)*["\']*[[:blank:]]*/>','<br><i><phpdig:ignore_message/></i></td>',$regs);

this doesn't (php loops) :

eregi('<phpdig:([a-z0-9_]*)[[:blank:]]*(src=)*["\']*([a-z0-9./_-]+)*["\']*[[:blank:]]*/>','<br><i><phpdig:ignore_common_message/></i></td>',$regs);


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

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/?id=14304


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



Thread (9 messages)

« previous php.dev (#75654) next »