Changeset 6f488bb in github


Ignore:
Timestamp:
Aug 20, 2008 2:33:40 AM (5 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
3b0eda1
Parents:
b469a19
Message:

#1485286: don't use /e modifier with preg_replace()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube_template.php

    rff73e02 r6f488bb  
    485485    private function parse_xml($input) 
    486486    { 
    487         return preg_replace('/<roundcube:([-_a-z]+)\s+([^>]+)>/Uie', "\$this->xml_command('\\1', '\\2')", $input); 
     487        return preg_replace_callback('/<roundcube:([-_a-z]+)\s+([^>]+)>/Ui', array($this, 'xml_command_callback'), $input); 
     488    } 
     489 
     490 
     491    /** 
     492     * This is a callback function for preg_replace_callback (see #1485286) 
     493     * It's only purpose is to reconfigure parameters for xml_command, so that the signature isn't disturbed 
     494     */ 
     495    private function xml_command_callback($matches) 
     496    { 
     497        if (isset($matches[2])) { 
     498            $str_attrib = $matches[2]; 
     499        } else { 
     500            $str_attrib = ''; 
     501        } 
     502 
     503        if (isset($matches[3])) { 
     504            $add_attrib = $matches[3]; 
     505        } else { 
     506            $add_attrib = array(); 
     507        } 
     508 
     509        $command = $matches[1]; 
     510        //matches[0] is the entire matched portion of the string 
     511 
     512        return $this->xml_command($command, $str_attrib, $add_attrib); 
    488513    } 
    489514 
Note: See TracChangeset for help on using the changeset viewer.