chregu                                   Wed, 31 Aug 2011 09:14:08 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=315867

Log:
- Set an empty string and avoid warnings and stopping of the transformation 
process
when a php function can't be called.
- Fixed tests.

Changed paths:
    U   
php/php-src/branches/PHP_5_4/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcnostring.phpt
    U   
php/php-src/branches/PHP_5_4/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcundef.phpt
    U   php/php-src/branches/PHP_5_4/ext/xsl/xsltprocessor.c
    U   
php/php-src/trunk/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcnostring.phpt
    U   
php/php-src/trunk/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcundef.phpt
    U   php/php-src/trunk/ext/xsl/xsltprocessor.c

Modified: 
php/php-src/branches/PHP_5_4/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcnostring.phpt
===================================================================
--- 
php/php-src/branches/PHP_5_4/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcnostring.phpt
     2011-08-31 08:58:12 UTC (rev 315866)
+++ 
php/php-src/branches/PHP_5_4/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcnostring.phpt
     2011-08-31 09:14:08 UTC (rev 315867)
@@ -25,13 +25,7 @@
 NULL

 Warning: XSLTProcessor::transformToXml(): Handler name must be a string in %s 
on line %d
-
-Warning: XSLTProcessor::transformToXml(): xmlXPathCompiledEval: evaluation 
failed in %s on line %d
-
-Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %d 
element value-of in %s on line %d
-
-Warning: XSLTProcessor::transformToXml(): xsltValueOf: text copy failed in %s 
on line %d
-bool(false)
+NULL
 --CREDITS--
 Christian Weiske, cwei...@php.net
 PHP Testfest Berlin 2009-05-09

Modified: 
php/php-src/branches/PHP_5_4/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcundef.phpt
===================================================================
--- 
php/php-src/branches/PHP_5_4/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcundef.phpt
        2011-08-31 08:58:12 UTC (rev 315866)
+++ 
php/php-src/branches/PHP_5_4/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcundef.phpt
        2011-08-31 09:14:08 UTC (rev 315867)
@@ -24,13 +24,7 @@
 NULL

 Warning: XSLTProcessor::transformToXml(): Unable to call handler 
undefinedfunc() in %s on line %d
-
-Warning: XSLTProcessor::transformToXml(): xmlXPathCompiledEval: evaluation 
failed in %s on line %d
-
-Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %d 
element value-of in %s on line %d
-
-Warning: XSLTProcessor::transformToXml(): xsltValueOf: text copy failed in %s 
on line %d
-bool(false)
+NULL
 --CREDITS--
 Christian Weiske, cwei...@php.net
 PHP Testfest Berlin 2009-05-09

Modified: php/php-src/branches/PHP_5_4/ext/xsl/xsltprocessor.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/xsl/xsltprocessor.c        2011-08-31 
08:58:12 UTC (rev 315866)
+++ php/php-src/branches/PHP_5_4/ext/xsl/xsltprocessor.c        2011-08-31 
09:14:08 UTC (rev 315867)
@@ -302,6 +302,7 @@
        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 @@
        /*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 @@
                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) {

Modified: 
php/php-src/trunk/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcnostring.phpt
===================================================================
--- 
php/php-src/trunk/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcnostring.phpt
        2011-08-31 08:58:12 UTC (rev 315866)
+++ 
php/php-src/trunk/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcnostring.phpt
        2011-08-31 09:14:08 UTC (rev 315867)
@@ -25,13 +25,7 @@
 NULL

 Warning: XSLTProcessor::transformToXml(): Handler name must be a string in %s 
on line %d
-
-Warning: XSLTProcessor::transformToXml(): xmlXPathCompiledEval: evaluation 
failed in %s on line %d
-
-Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %d 
element value-of in %s on line %d
-
-Warning: XSLTProcessor::transformToXml(): xsltValueOf: text copy failed in %s 
on line %d
-bool(false)
+NULL
 --CREDITS--
 Christian Weiske, cwei...@php.net
 PHP Testfest Berlin 2009-05-09

Modified: 
php/php-src/trunk/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcundef.phpt
===================================================================
--- 
php/php-src/trunk/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcundef.phpt
   2011-08-31 08:58:12 UTC (rev 315866)
+++ 
php/php-src/trunk/ext/xsl/tests/xsltprocessor_registerPHPFunctions-funcundef.phpt
   2011-08-31 09:14:08 UTC (rev 315867)
@@ -24,13 +24,7 @@
 NULL

 Warning: XSLTProcessor::transformToXml(): Unable to call handler 
undefinedfunc() in %s on line %d
-
-Warning: XSLTProcessor::transformToXml(): xmlXPathCompiledEval: evaluation 
failed in %s on line %d
-
-Warning: XSLTProcessor::transformToXml(): runtime error: file %s line %d 
element value-of in %s on line %d
-
-Warning: XSLTProcessor::transformToXml(): xsltValueOf: text copy failed in %s 
on line %d
-bool(false)
+NULL
 --CREDITS--
 Christian Weiske, cwei...@php.net
 PHP Testfest Berlin 2009-05-09

Modified: php/php-src/trunk/ext/xsl/xsltprocessor.c
===================================================================
--- php/php-src/trunk/ext/xsl/xsltprocessor.c   2011-08-31 08:58:12 UTC (rev 
315866)
+++ php/php-src/trunk/ext/xsl/xsltprocessor.c   2011-08-31 09:14:08 UTC (rev 
315867)
@@ -302,6 +302,7 @@
        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 @@
        /*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 @@
                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) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to