Opened 16 years ago

Closed 14 years ago

#787 closed Defect (fixed)

PHP 5.3 compatibility - ereg

Reported by: Nicolas Owned by: davea
Priority: Minor Milestone: Undetermined
Component: Web - Project Version:
Keywords: patch Cc:

Description

PHP 5.3 will deprecate the "ereg" module, in favor of Perl-compatible regular expressions (PCRE). I think it will be completely removed in PHP 6.

I found two places that used ereg_replace where actually they don't need any kind of regular expressions (patch attached).

html/inc/geoip.inc uses ereg. I still haven't checked what it does with it; it's 3rd party code.

html/inc/bolt_ex.inc has one use of it. I think it should be changed to PCRE, but that would mean functionality and documentation changes (do the BOLT docs say what kind of regex is used?).

Attachments (1)

ereg_replace_remove.diff (989 bytes) - added by Nicolas 16 years ago.

Download all attachments as: .zip

Change History (7)

Changed 16 years ago by Nicolas

Attachment: ereg_replace_remove.diff added

comment:1 Changed 15 years ago by Nicolas

PHP 5.3.0 was officially released 30 June 2009.

comment:2 Changed 15 years ago by davea

Resolution: fixed
Status: newclosed

(In [19010]) - web: remove usage of ereg_replace()

Fixes #787. From Nicolas Alvarez.

comment:3 Changed 14 years ago by Nicolas

Resolution: fixed
Status: closedreopened

r18109 introduced a new ereg() call. Patch coming soon.

comment:4 Changed 14 years ago by Nicolas

  • html/inc/translation.inc

    function getPOLineContent($line, $file){ 
    159159    $start = strpos($line, '"')+1;
    160160    $stop = strrpos($line, '"');
    161161    $x =  substr($line, $start, $stop-$start);
    162     $n = ereg("[^\\]\"", $x);
     162    $n = preg_match("/[^\\\\]\"/", $x);
    163163    if ($n) {
    164164        echo "ERROR - MISMATCHED QUOTES IN $file: $line\n";
    165165        return "";

comment:5 Changed 14 years ago by Nicolas

Keywords: patch added

comment:6 Changed 14 years ago by davea

Resolution: fixed
Status: reopenedclosed

(In [21878]) - user web: PHP 5.3 compatibility fix, from Nicolas. Fixes #787

Note: See TracTickets for help on using tickets.