From 6f488bb55f08d64bbdd5255079a24501e55e6851 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 20 Aug 2008 02:33:40 -0400
Subject: [PATCH] #1485286: don't use /e modifier with preg_replace()
---
program/include/rcube_template.php | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php
index fb65411..37929de 100755
--- a/program/include/rcube_template.php
+++ b/program/include/rcube_template.php
@@ -484,7 +484,32 @@
*/
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);
}
--
Gitblit v1.9.1