From 368039856fd7819325fd3e4c5a0c5c46052daf18 Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Thu, 3 Nov 2011 22:11:34 +0100 Subject: [PATCH] Fix a segfaulting bug in the PHP5 SWIG version; we would get confused when PHP had converted a string into a number. --- php5-swig/xml-template.swig | 10 ++++++++++ 1 file changed, 10 insertions(+) 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) { -- 2.39.2