diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-08-20 06:33:40 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-08-20 06:33:40 +0000 |
| commit | 719bd715e1212afe2ed69009350b45874b60cd93 (patch) | |
| tree | afd4171cea8d5f9bbf29092d1e55cf8f1cd5fa76 /roundcubemail/program | |
| parent | 0164cd4315d1001019e646ce56ad473a9ed30cd2 (diff) | |
#1485286: don't use /e modifier with preg_replace()
git-svn-id: https://svn.roundcube.net/trunk@1660 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program')
| -rwxr-xr-x | roundcubemail/program/include/rcube_template.php | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/roundcubemail/program/include/rcube_template.php b/roundcubemail/program/include/rcube_template.php index fb6541153..37929de2d 100755 --- a/roundcubemail/program/include/rcube_template.php +++ b/roundcubemail/program/include/rcube_template.php @@ -484,7 +484,32 @@ class rcube_template extends rcube_html_page */ private function parse_xml($input) { - return preg_replace('/<roundcube:([-_a-z]+)\s+([^>]+)>/Uie', "\$this->xml_command('\\1', '\\2')", $input); + return preg_replace_callback('/<roundcube:([-_a-z]+)\s+([^>]+)>/Ui', array($this, 'xml_command_callback'), $input); + } + + + /** + * This is a callback function for preg_replace_callback (see #1485286) + * It's only purpose is to reconfigure parameters for xml_command, so that the signature isn't disturbed + */ + private function xml_command_callback($matches) + { + if (isset($matches[2])) { + $str_attrib = $matches[2]; + } else { + $str_attrib = ''; + } + + if (isset($matches[3])) { + $add_attrib = $matches[3]; + } else { + $add_attrib = array(); + } + + $command = $matches[1]; + //matches[0] is the entire matched portion of the string + + return $this->xml_command($command, $str_attrib, $add_attrib); } |
