Elizabeth Marie Smith
2012-08-09 03:07:37 UTC
Commit: 4cda109cf9fbc3498df709a0cf009da93919439e
Author: Elizabeth M Smith <***@gmail.com> Wed, 8 Aug 2012 23:07:37 -0400
Parents: c3eded3df0c68c1700652204afc726d8425bd7d6
Branches: master
Link: http://git.php.net/?p=php/gtk-src.git;a=commitdiff;h=4cda109cf9fbc3498df709a0cf009da93919439e
Log:
This officially breaks building with anything less then 5.3
with the generator since it uses closures
But I can't get rid the of the /e modifier in the regex
without using a closure to wrap up that array information
so I'm stuck - either I break the generator for 5.2
or it spews on 5.4
Note this doesn't mean you can't still build against 5.2
you just need php 5.3 cli or higher to do the build
Changed paths:
M generator/array_printf.php
Diff:
diff --git a/generator/array_printf.php b/generator/array_printf.php
index a8d6473..cf84ba7 100644
--- a/generator/array_printf.php
+++ b/generator/array_printf.php
@@ -5,7 +5,12 @@ function aprintf($tmpl, $array)
$array = (array)$array;
if (count($array) < 1) return $tmpl;
- return preg_replace('!%\((\w+)\)!e', 'isset(\$array["$1"]) ? \$array["$1"] : ""', $tmpl);
-}
+ $callback =
+ function ($matches) use ($array)
+ {
+ return isset($array[$matches[1]]) ? $array[$matches[1]] : "";
+ };
-?>
+ return preg_replace_callback('!%\((\w+)\)!', $callback, $tmpl);
+}
+?>
\ No newline at end of file
Author: Elizabeth M Smith <***@gmail.com> Wed, 8 Aug 2012 23:07:37 -0400
Parents: c3eded3df0c68c1700652204afc726d8425bd7d6
Branches: master
Link: http://git.php.net/?p=php/gtk-src.git;a=commitdiff;h=4cda109cf9fbc3498df709a0cf009da93919439e
Log:
This officially breaks building with anything less then 5.3
with the generator since it uses closures
But I can't get rid the of the /e modifier in the regex
without using a closure to wrap up that array information
so I'm stuck - either I break the generator for 5.2
or it spews on 5.4
Note this doesn't mean you can't still build against 5.2
you just need php 5.3 cli or higher to do the build
Changed paths:
M generator/array_printf.php
Diff:
diff --git a/generator/array_printf.php b/generator/array_printf.php
index a8d6473..cf84ba7 100644
--- a/generator/array_printf.php
+++ b/generator/array_printf.php
@@ -5,7 +5,12 @@ function aprintf($tmpl, $array)
$array = (array)$array;
if (count($array) < 1) return $tmpl;
- return preg_replace('!%\((\w+)\)!e', 'isset(\$array["$1"]) ? \$array["$1"] : ""', $tmpl);
-}
+ $callback =
+ function ($matches) use ($array)
+ {
+ return isset($array[$matches[1]]) ? $array[$matches[1]] : "";
+ };
-?>
+ return preg_replace_callback('!%\((\w+)\)!', $callback, $tmpl);
+}
+?>
\ No newline at end of file
--
PHP-GTK CVS Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
PHP-GTK CVS Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php