[PHP-DEV] PHP 4.0 Bug #8895 Updated: xslt_process() documentation problem
ID: 8895 User Update by: [EMAIL PROTECTED] Old-Status: Closed Status: Open Bug Type: Sablotron XSL Description: xslt_process() documentation problem This is ridiculous - this is the second time this bug has been closed by someone who never bothered to read the report! According to the documentation: The xslt_process() takes a string containing the XSLT stylesheet as its first argument, it takes a second string containing the XML data you want to transform and then a third string containing the results of the transformation. xslt_process() will return true on success and false on failure, to get the error number and error string if an error occurs use the xslt_errno() and xslt_error() functions. There is no conceivable way returning an untrappable fatal error can be seen as a simple return false, particularly since the comment about errors suggests that your script will continue executing if xslt_process() encounters an error. Currently, there's no way to call xslt_errno() / xslt_error(). There are three options at this point: actually fixing the Sablotron extension or changing the documentation to say something like "If the transform fails, PHP will immediately terminate with a fatal error". Or you could just close it a 3rd time with a bogus comment - I won't bother reopening it, as I don't use Sablotron regularly. This still reproduces with 4.0.5-dev, built from a CVS checkout on 3/26. Previous Comments: --- [2001-04-05 14:16:06] [EMAIL PROTECTED] this is the correct behavior, if the transformation fails so will php. --- [2001-02-14 10:53:39] [EMAIL PROTECTED] Please try to read the bug report before closing it. xslt_process() does *NOT* return false with some errors. Instead, it returns a PHP fatal error which cannot be trapped using @. --- [2001-02-14 06:19:21] [EMAIL PROTECTED] not a bug. xslt_process() returns false on failure, you can supress errors using the @ sign. --- [2001-01-25 02:02:18] [EMAIL PROTECTED] According to the documentation xslt_process() is supposed to return false and allow you to check errors with xslt_errno() xslt_error(). I found several situations where a validation error in the XSL stylesheet would cause it to instead fail with a fatal error: PHP Fatal error: msgtype: error in /var/www/stone2/index.php on line 18 (One example of an error would be a HTML tag with unquoted parameters (e.g. BORDER=0), which is legal for numeric values in HTML but not XML) Needless to say, this made debugging rather tricky as it never reached the error display in my code: if (xslt_process($XSL, $XML, $result)) { echo $result; } else { echo 'PXSL transformation error: /P'; echo xslt_errno() . ': ' . xslt_error(); } PHP config info: PHP Version 4.0.4pl1 System Linux gigante 2.2.18pre21 #1 Sat Nov 18 18:47:15 EST 2000 i686 unknown Build Date Jan 24 2001 Configure Command './configure' '--with-apxs' '--enable-shared' '--with-bz2' '--with-java=/usr/local/jdk1.3' '--with-gettext' '--with-mcrypt' '--with-zlib' '--with-openssl=/usr/local/ssl' '--enable-magic-quotes' '--enable-calendar' '--with-curl' '--with-mcrypt' '--with-dom=/usr/local/lib' '--enable-ftp' '--enable-gd-imgstrttf' '--with-gd' '--with-jpeg-dir' '--with-ttf' '--with-t1lib' '--with-imap-ssl' '--with-imap' '--with-ldap' '--with-mysql' '--with-pdflib=/usr/local/lib' '--with-zlib-dir' '--with-jpeg-dir' '--with-png-dir' '--with-tiff-dir' '--with-pgsql' '--with-pspell' '--with-readline' '--with-sablot' '--with-sablot-errors-descriptive' '--enable-trans-sid' '--enable-shmop' '--enable-sockets' '--with-swf' '--enable-sysvsem' '--enable-sysvshm' '--enable-inline-optimization' '--enable-memory-limit' --- Full Bug description available at: http://bugs.php.net/?id=8895 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] PHP 4.0 Bug #8895 Updated: xslt_process() documentation problem
ID: 8895 Updated by: sterling Reported By: [EMAIL PROTECTED] Old-Status: Open Status: Closed Bug Type: Sablotron XSL Assigned To: sterling Comments: The xslt_process() function *does* return false on failure. However, if the error is serious enough, the php script will exit out, as with any of the sablotron functions. Furthermore, it never sends a fatal error if the transformation fails, it sends an error of type E_ERROR for critical sablotron errors transformations and an error of type E_WARNING for warnings. Previous Comments: --- [2001-04-05 17:00:23] [EMAIL PROTECTED] This is ridiculous - this is the second time this bug has been closed by someone who never bothered to read the report! According to the documentation: The xslt_process() takes a string containing the XSLT stylesheet as its first argument, it takes a second string containing the XML data you want to transform and then a third string containing the results of the transformation. xslt_process() will return true on success and false on failure, to get the error number and error string if an error occurs use the xslt_errno() and xslt_error() functions. There is no conceivable way returning an untrappable fatal error can be seen as a simple return false, particularly since the comment about errors suggests that your script will continue executing if xslt_process() encounters an error. Currently, there's no way to call xslt_errno() / xslt_error(). There are three options at this point: actually fixing the Sablotron extension or changing the documentation to say something like "If the transform fails, PHP will immediately terminate with a fatal error". Or you could just close it a 3rd time with a bogus comment - I won't bother reopening it, as I don't use Sablotron regularly. This still reproduces with 4.0.5-dev, built from a CVS checkout on 3/26. --- [2001-04-05 14:16:06] [EMAIL PROTECTED] this is the correct behavior, if the transformation fails so will php. --- [2001-02-14 10:53:39] [EMAIL PROTECTED] Please try to read the bug report before closing it. xslt_process() does *NOT* return false with some errors. Instead, it returns a PHP fatal error which cannot be trapped using @. --- [2001-02-14 06:19:21] [EMAIL PROTECTED] not a bug. xslt_process() returns false on failure, you can supress errors using the @ sign. --- [2001-01-25 02:02:18] [EMAIL PROTECTED] According to the documentation xslt_process() is supposed to return false and allow you to check errors with xslt_errno() xslt_error(). I found several situations where a validation error in the XSL stylesheet would cause it to instead fail with a fatal error: PHP Fatal error: msgtype: error in /var/www/stone2/index.php on line 18 (One example of an error would be a HTML tag with unquoted parameters (e.g. BORDER=0), which is legal for numeric values in HTML but not XML) Needless to say, this made debugging rather tricky as it never reached the error display in my code: if (xslt_process($XSL, $XML, $result)) { echo $result; } else { echo 'PXSL transformation error: /P'; echo xslt_errno() . ': ' . xslt_error(); } PHP config info: PHP Version 4.0.4pl1 System Linux gigante 2.2.18pre21 #1 Sat Nov 18 18:47:15 EST 2000 i686 unknown Build Date Jan 24 2001 Configure Command './configure' '--with-apxs' '--enable-shared' '--with-bz2' '--with-java=/usr/local/jdk1.3' '--with-gettext' '--with-mcrypt' '--with-zlib' '--with-openssl=/usr/local/ssl' '--enable-magic-quotes' '--enable-calendar' '--with-curl' '--with-mcrypt' '--with-dom=/usr/local/lib' '--enable-ftp' '--enable-gd-imgstrttf' '--with-gd' '--with-jpeg-dir' '--with-ttf' '--with-t1lib' '--with-imap-ssl' '--with-imap' '--with-ldap' '--with-mysql' '--with-pdflib=/usr/local/lib' '--with-zlib-dir' '--with-jpeg-dir' '--with-png-dir' '--with-tiff-dir' '--with-pgsql' '--with-pspell' '--with-readline' '--with-sablot' '--with-sablot-errors-descriptive' '--enable-trans-sid' '--enable-shmop' '--enable-sockets' '--with-swf' '--enable-sysvsem' '--enable-sysvshm' '--enable-inline-optimization' '--enable-memory-limit' --- The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online. ATTENTION! Do NOT reply to
Re: [PHP-DEV] PHP 4.0 Bug #8895 Updated: xslt_process() documentation problem
On 5 Apr 2001 17:05:34 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: ID: 8895 Updated by: sterling Reported By: [EMAIL PROTECTED] Old-Status: Open Status: Closed Bug Type: Sablotron XSL Assigned To: sterling Comments: The xslt_process() function *does* return false on failure. However, if the error is serious enough, the php script will exit out, as with any of the sablotron functions. Furthermore, it never sends a fatal error if the transformation fails, it sends an error of type E_ERROR for critical sablotron errors transformations and an error of type E_WARNING for warnings. This sounds like a question of semantics - I consider anything which will cause PHP to halt execution with the message "Fatal Error" as a fatal error, even if the sablotron extension is doing a RETURN_FALSE internally. Since there's no possible way for a PHP developer to trap such an error, it sounds like the documentation should be updated to reflect the way xslt_process() actually behaves. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] PHP 4.0 Bug #8895 Updated: xslt_process() documentation problem
On Thu, Apr 05, 2001 at 10:29:03PM -0400, Sterling Hughes wrote: On Thu, 5 Apr 2001, Chris Adams wrote: On 5 Apr 2001 17:05:34 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: ID: 8895 The xslt_process() function *does* return false on failure. However, if the error is serious enough, the php script will exit out, as with any of the sablotron functions. Furthermore, it never sends a fatal error if the transformation fails, it sends an error of type E_ERROR for critical sablotron errors transformations and an error of type E_WARNING for warnings. This sounds like a question of semantics - I consider anything which will cause PHP to halt execution with the message "Fatal Error" as a fatal error, even if the sablotron extension is doing a RETURN_FALSE internally. Since there's no possible way for a PHP developer to trap such an error, it sounds like the documentation should be updated to reflect the way xslt_process() actually behaves. In some cases you *can* trap the error, that's why its documented as so. Other cases its not possible (E_WARNING or no error thrown, such as inability to allocate memory), its the same way with many other functions in php. True - I just think this should be reflected more in the documentation (even if it is just "really nasty errors can't be trapped"), particularly in the case of functions like this which could die on user-provided data. Similarly, I'm guessing that Sablotron doesn't provide more debugging information but is there any way it could be a little more informative? It's a little frustrating to get that sort of error with 30K of complex XSL. Chris PGP signature
[PHP-DEV] PHP 4.0 Bug #8895 Updated: xslt_process() documentation problem
ID: 8895 Updated by: sterling Reported By: [EMAIL PROTECTED] Old-Status: Open Status: Closed Bug Type: Sablotron XSL Assigned To: Comments: not a bug. xslt_process() returns false on failure, you can supress errors using the @ sign. Previous Comments: --- [2001-01-25 02:02:18] [EMAIL PROTECTED] According to the documentation xslt_process() is supposed to return false and allow you to check errors with xslt_errno() xslt_error(). I found several situations where a validation error in the XSL stylesheet would cause it to instead fail with a fatal error: PHP Fatal error: msgtype: error in /var/www/stone2/index.php on line 18 (One example of an error would be a HTML tag with unquoted parameters (e.g. BORDER=0), which is legal for numeric values in HTML but not XML) Needless to say, this made debugging rather tricky as it never reached the error display in my code: if (xslt_process($XSL, $XML, $result)) { echo $result; } else { echo 'PXSL transformation error: /P'; echo xslt_errno() . ': ' . xslt_error(); } PHP config info: PHP Version 4.0.4pl1 System Linux gigante 2.2.18pre21 #1 Sat Nov 18 18:47:15 EST 2000 i686 unknown Build Date Jan 24 2001 Configure Command './configure' '--with-apxs' '--enable-shared' '--with-bz2' '--with-java=/usr/local/jdk1.3' '--with-gettext' '--with-mcrypt' '--with-zlib' '--with-openssl=/usr/local/ssl' '--enable-magic-quotes' '--enable-calendar' '--with-curl' '--with-mcrypt' '--with-dom=/usr/local/lib' '--enable-ftp' '--enable-gd-imgstrttf' '--with-gd' '--with-jpeg-dir' '--with-ttf' '--with-t1lib' '--with-imap-ssl' '--with-imap' '--with-ldap' '--with-mysql' '--with-pdflib=/usr/local/lib' '--with-zlib-dir' '--with-jpeg-dir' '--with-png-dir' '--with-tiff-dir' '--with-pgsql' '--with-pspell' '--with-readline' '--with-sablot' '--with-sablot-errors-descriptive' '--enable-trans-sid' '--enable-shmop' '--enable-sockets' '--with-swf' '--enable-sysvsem' '--enable-sysvshm' '--enable-inline-optimization' '--enable-memory-limit' --- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=8895edit=2 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]