[PHP] Fix code generated for feature("director:except")
Previously the return value of call_user_function() was ignored and we checked an uninitialised value instead. Fixes #627. Based on patch from Sergey Seroshtan.
This commit is contained in:
parent
0769e9b727
commit
1adfe2f537
3 changed files with 26 additions and 0 deletions
|
|
@ -5,6 +5,12 @@ See the RELEASENOTES file for a summary of changes in each release.
|
|||
Version 3.0.11 (in progress)
|
||||
============================
|
||||
|
||||
2016-09-24: olly
|
||||
[PHP] Fix code generated for feature("director:except") -
|
||||
previously the return value of call_user_function() was ignored and
|
||||
we checked an uninitialised value instead. Fixes #627. Based on
|
||||
patch from Sergey Seroshtan.
|
||||
|
||||
2016-09-17: wsfulton
|
||||
[Python] Fix iterators for containers of NULL pointers (or Python None) when using
|
||||
-builtin. Previously iteration would stop at the first element that was NULL.
|
||||
|
|
|
|||
|
|
@ -28,6 +28,21 @@ class DirectorMethodException: public Swig::DirectorException {};
|
|||
|
||||
%include "std_string.i"
|
||||
|
||||
#ifdef SWIGPHP
|
||||
|
||||
%feature("director:except") {
|
||||
if ($error == FAILURE) {
|
||||
throw Swig::DirectorMethodException();
|
||||
}
|
||||
}
|
||||
|
||||
%exception {
|
||||
try { $action }
|
||||
catch (Swig::DirectorException &) { SWIG_fail; }
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef SWIGPYTHON
|
||||
|
||||
%feature("director:except") {
|
||||
|
|
|
|||
|
|
@ -2625,6 +2625,7 @@ done:
|
|||
}
|
||||
|
||||
/* exception handling */
|
||||
bool error_used_in_typemap = false;
|
||||
tm = Swig_typemap_lookup("director:except", n, Swig_cresult_name(), 0);
|
||||
if (!tm) {
|
||||
tm = Getattr(n, "feature:director:except");
|
||||
|
|
@ -2634,6 +2635,7 @@ done:
|
|||
if ((tm) && Len(tm) && (Strcmp(tm, "1") != 0)) {
|
||||
if (Replaceall(tm, "$error", "error")) {
|
||||
/* Only declare error if it is used by the typemap. */
|
||||
error_used_in_typemap = true;
|
||||
Append(w->code, "int error;\n");
|
||||
}
|
||||
} else {
|
||||
|
|
@ -2657,6 +2659,9 @@ done:
|
|||
/* wrap complex arguments to zvals */
|
||||
Printv(w->code, wrap_args, NIL);
|
||||
|
||||
if (error_used_in_typemap) {
|
||||
Append(w->code, "error = ");
|
||||
}
|
||||
Append(w->code, "call_user_function(EG(function_table), (zval**)&swig_self, &funcname,");
|
||||
Printf(w->code, " %s, %d, args TSRMLS_CC);\n", Swig_cresult_name(), idx);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue