Bug 100890 - regex parsing error on literal { or }
Summary: regex parsing error on literal { or }
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: php
Version: 7.3
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Joe Orton
QA Contact: David Lawrence
URL: https://ygdev.ram.ac.uk/phptest.php
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-07-26 19:55 UTC by Yan Fitterer
Modified: 2007-04-18 16:56 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-01-25 16:46:59 UTC
Embargoed:


Attachments (Terms of Use)

Description Yan Fitterer 2003-07-26 19:55:06 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312

Description of problem:
Trying to match a literal { or } inside a POSIX regex (ereg function for ex)
doesn't work in all cases. 

Version-Release number of selected component (if applicable):
php-4.1.2-7.3.6

How reproducible:
Always

Steps to Reproduce:
<?php
if (ereg("^\{$","{")) echo "^\{$ matched {";
if (ereg("^\{\}$","{}")) echo "^\{\}$ matched {}";
?>


Actual Results:
Warning: Unmatched \{ in /usr/local/typo3/museum/phptest.php on line 2
Warning: Invalid content of \{\} in /usr/local/typo3/museum/phptest.php on line 3


Expected Results:
^{$ matched {
^{\}$ matched {} 

Additional info:

Works OK in php 4.2.3. Not sure exact version when was fixed.

Comment 1 Joe Orton 2003-07-28 10:49:40 UTC
See http://www.php.net/manual/en/language.types.string.php

You need to escape the regex pattern like

 ereg("^\{\}\$","{}"))



Comment 2 Yan Fitterer 2003-07-29 07:56:12 UTC
Slight problem here, the expression as I originally quoted it works OK on other 
compiles of php 4.1.2, including those in use by the php.net people. 

See http://bugs.php.net/bug.php?id=24821

As explained (and verified by me on several boxes), this very script works OK 
on other 4.1.2 compiles, on 4.2.2, on 4.2.3 and on latest PHP5-dev.

I hear from some more experienced programmer that it's something to do with the 
non-default compiled regex library - maybe something to do with your
"--with-regex=system" compile switch?

The bottom line of this is that some perfectly working php code (as far as the 
rest of the world is concerned), doesn't work on RH 7.3. What can you do about 
it?

Thanks
Yan

Comment 3 Joe Orton 2005-01-25 16:46:59 UTC
Thanks for the report.  This is a mass bug update; since this release
of Red Hat Linux is no longer supported, please either:

a) try and reproduce the bug with a supported version of Red Hat
Enterprise Linux or Fedora Core, and re-open this bug as appropriate
after changing the Product field, or,

b) if relevant, try and reproduce this bug using the current version
of the upstream package, and report the bug upstream.

c) report the bug to the Fedora Legacy project who may wish to
continue maintenance of this package.



Note You need to log in before you can comment on or make changes to this bug.