From fcb46fe2fa2383c8ef2f1f0844a2d4e5038c204b Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Thu, 10 May 2012 11:41:19 +0000 Subject: [PATCH] [PHP] Fix the constant typemaps for SWIGTYPE, etc - previously these used the wrong name for renamed constants. Add autodoc_runme.php to the testsuite as a regression test for this. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13062 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- CHANGES.current | 5 +++++ Examples/test-suite/php/autodoc_runme.php | 9 +++++++++ Lib/php/const.i | 7 ++----- 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 Examples/test-suite/php/autodoc_runme.php diff --git a/CHANGES.current b/CHANGES.current index 730f56228..9834ce2ea 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,11 @@ See the RELEASENOTES file for a summary of changes in each release. Version 2.0.7 (in progress) =========================== +2012-05-10: olly + [PHP] Fix the constant typemaps for SWIGTYPE, etc - previously + these used the wrong name for renamed constants. Add + autodoc_runme.php to the testsuite as a regression test for this. + 2012-05-02: ianlancetaylor [Go] Remove compatibility support for gccgo 4.6. Using SWIG with gccgo will now require gccgo 4.7. Using SWIG diff --git a/Examples/test-suite/php/autodoc_runme.php b/Examples/test-suite/php/autodoc_runme.php new file mode 100644 index 000000000..f2e19d3cb --- /dev/null +++ b/Examples/test-suite/php/autodoc_runme.php @@ -0,0 +1,9 @@ + diff --git a/Lib/php/const.i b/Lib/php/const.i index afd7d02b9..78f3a8a08 100644 --- a/Lib/php/const.i +++ b/Lib/php/const.i @@ -32,17 +32,14 @@ %typemap(consttab) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { - /* This actually registers it as a global variable and constant. I don't - * like it, but I can't figure out the zend_constant code... */ zval *z_var; MAKE_STD_ZVAL(z_var); SWIG_SetPointerZval(z_var, (void*)$value, $1_descriptor, 0); - /* zend_hash_add(&EG(symbol_table), "$1", sizeof("$1"), (void *)&z_var,sizeof(zval *), NULL); */ zend_constant c; c.value = *z_var; zval_copy_ctor(&c.value); - size_t len = sizeof("$1") - 1; - c.name = zend_strndup("$1", len); + size_t len = sizeof("$symname") - 1; + c.name = zend_strndup("$symname", len); c.name_len = len+1; c.flags = CONST_CS | CONST_PERSISTENT; c.module_number = module_number;