PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » XML » XML_XSLT_Wrapper » Bug #3217

Bad compare gives bogus failure: XSLTPROC

Details

Submitted2005-01-16 17:09 UTC
Fromjdickey at seven-sigma dot com
Assignedarnaud
StatusClosed
PackageXML_XSLT_Wrapper
PHP Version5.0.3
OSWindows (XP/SP2)
Roadmaps(Not assigned)

Comments

[2005-01-16 17:09 UTC] jdickey at seven-sigma dot com

Description:
------------
This bug was first noticed in version 1.4 of php5\PEAR\pear\XML\XSLT\Wrapper\Backend\XSLTPROC.PHP; it continues on up to version 1.6.

The comparison at line 241 is incorrect. It compares a string value to .gt. 0 when it should compare the LENGTH of the string.

Reproduce code:
---------------
Output from diff -u follows for the fixed file.

--- XSLTPROC.php.1.6 Mon Jan 17 00:40:58 2005
+++ XSLTPROC.php Mon Jan 17 00:40:22 2005
@@ -238,7 +238,7 @@
$string_result = $result;
}

- if ($return_code == 0 && is_string($string_result) && $string_result > 0){
+ if ($return_code == 0 && is_string($string_result) && ( strlen( $string_result ) > 0)){
return $string_result;
} else {
$this->error = PEAR::raiseError(null,

Expected result:
----------------
The original code will cause the function to always return a value of false; i.e., to fail to return the text already stored in the variable $string_result. Making the change will repair that problem in a manner apparently consistent with the intent of the original coder.

Actual result:
--------------
The original code will cause the function to always return a value of false; i.e., to fail to return the text already stored in the variable $string_result. Making the change will repair that problem in a manner apparently consistent with the intent of the original coder.