From: sgunderson@bigfoot.com <> Date: Thu, 3 Nov 2011 21:11:34 +0000 (+0100) Subject: Fix a segfaulting bug in the PHP5 SWIG version; we would get confused when PHP had... X-Git-Url: https://git.sesse.net/?p=xml-template;a=commitdiff_plain;h=368039856fd7819325fd3e4c5a0c5c46052daf18 Fix a segfaulting bug in the PHP5 SWIG version; we would get confused when PHP had converted a string into a number. --- diff --git a/php5-swig/xml-template.swig b/php5-swig/xml-template.swig index 5e4e133..458296e 100644 --- a/php5-swig/xml-template.swig +++ b/php5-swig/xml-template.swig @@ -72,6 +72,16 @@ Directive* convert_php_objects_to_directive(zval *obj) char *str = Z_STRVAL_P(obj); return new Replace(str); } + case IS_LONG: { + char str[256]; + snprintf(str, sizeof(str), "%ld", Z_LVAL_P(obj)); + return new Replace(str); + } + case IS_DOUBLE: { + char str[256]; + snprintf(str, sizeof(str), "%f", Z_DVAL_P(obj)); + return new Replace(str); + } case IS_RESOURCE: { XmlDocPtrWrapper *doc; if (SWIG_ConvertPtr(obj, (void **)&doc, SWIGTYPE_p_XmlDocPtrWrapper, 0) < 0 || doc == NULL) {