From 24ff00690f2b1bc36bb8a00c9a236ce1c444e61c Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Sun, 14 Apr 2013 08:03:46 +1200 Subject: [PATCH] Use ZVAL_STRINGL instead of ZVAL_STRING to set funcname as we know the length at swig-time --- Source/Modules/php.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index bc8a92687..3cae48383 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -2597,7 +2597,8 @@ done: } Printf(w->code, "zval *%s, funcname;\n", Swig_cresult_name()); Printf(w->code, "MAKE_STD_ZVAL(%s);\n", Swig_cresult_name()); - Printf(w->code, "ZVAL_STRING(&funcname, (char *)\"%s\", 0);\n", GetChar(n, "sym:name")); + const char * funcname = GetChar(n, "sym:name"); + Printf(w->code, "ZVAL_STRINGL(&funcname, (char *)\"%s\", %d, 0);\n", funcname, strlen(funcname)); Append(w->code, "if (!swig_self) {\n"); Append(w->code, " SWIG_PHP_Error(E_ERROR, \"this pointer is NULL\");"); Append(w->code, "}\n\n");