summaryrefslogtreecommitdiff
path: root/ext/xsl/xsltprocessor.c
diff options
context:
space:
mode:
authorChristian Stocker <chregu@php.net>2011-08-31 09:14:08 +0000
committerChristian Stocker <chregu@php.net>2011-08-31 09:14:08 +0000
commit01e115324aa579c729d61588121cbe2e4b27afde (patch)
tree648ed8778f267b6d2f6d1476d9593d9278fecd6f /ext/xsl/xsltprocessor.c
parent43527a0f1cc376b01985100479e699a572a84692 (diff)
downloadphp-git-01e115324aa579c729d61588121cbe2e4b27afde.tar.gz
- Set an empty string and avoid warnings and stopping of the transformation process
when a php function can't be called. - Fixed tests.
Diffstat (limited to 'ext/xsl/xsltprocessor.c')
-rw-r--r--ext/xsl/xsltprocessor.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c
index d0baa1fdcf..32197c8158 100644
--- a/ext/xsl/xsltprocessor.c
+++ b/ext/xsl/xsltprocessor.c
@@ -302,6 +302,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
if (obj->stringval == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Handler name must be a string");
xmlXPathFreeObject(obj);
+ valuePush(ctxt, xmlXPathNewString(""));
if (fci.param_count > 0) {
for (i = 0; i < nargs - 1; i++) {
zval_ptr_dtor(&args[i]);
@@ -323,7 +324,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
/*fci.function_handler_cache = &function_ptr;*/
if (!zend_make_callable(&handler, &callable TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", callable);
-
+ valuePush(ctxt, xmlXPathNewString(""));
} else if ( intern->registerPhpFunctions == 2 && zend_hash_exists(intern->registered_phpfunctions, callable, strlen(callable) + 1) == 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not allowed to call handler '%s()'", callable);
/* Push an empty string, so that we at least have an xslt result... */
@@ -333,6 +334,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t
if (result == FAILURE) {
if (Z_TYPE(handler) == IS_STRING) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", Z_STRVAL_P(&handler));
+ valuePush(ctxt, xmlXPathNewString(""));
}
/* retval is == NULL, when an exception occured, don't report anything, because PHP itself will handle that */
} else if (retval == NULL) {