[php] Skip directorout typemap if PHP exception pending
Otherwise can end up with a second PHP exception if the directorout typemap doesn't accept PHP Null. `SWIG_fail` in this case results in us returning to PHP which then propagates the pending exception. This commit fixes a failure in smoketest.php in Xapian's PHP bindings, but I've not managed to come up with a reproducer which works for SWIG's testsuite.
This commit is contained in:
parent
b7f82d78e9
commit
2df27036b7
1 changed files with 8 additions and 4 deletions
|
|
@ -2249,11 +2249,13 @@ public:
|
|||
if (tm)
|
||||
tm = Copy(tm);
|
||||
}
|
||||
if ((tm) && Len(tm) && (Strcmp(tm, "1") != 0)) {
|
||||
Replaceall(tm, "$error", "EG(exception)");
|
||||
Printv(w->code, Str(tm), "\n", NIL);
|
||||
if (!tm || Len(tm) == 0 || Equal(tm, "1")) {
|
||||
// Skip marshalling the return value as there isn't one.
|
||||
tm = NewString("if ($error) SWIG_fail;");
|
||||
}
|
||||
Append(w->code, "}\n");
|
||||
|
||||
Replaceall(tm, "$error", "EG(exception)");
|
||||
Printv(w->code, Str(tm), "\n}\n{\n", NIL);
|
||||
Delete(tm);
|
||||
|
||||
/* marshal return value from PHP to C/C++ type */
|
||||
|
|
@ -2301,6 +2303,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
Append(w->code, "}\n");
|
||||
|
||||
Delete(cleanup);
|
||||
Delete(outarg);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue