Bug #70678 [NEW]: PHP7 returns true when false is expected
From: f dot bosch at genkgo dot nl
Operating system: worker-linux-docker
PHP version: 7.0.0RC4
Package: XSLT related
Bug Type: Bug
Bug description:PHP7 returns true when false is expected
Description:
------------
If you are using php functions inside an XSL script and return 'false',
then XSL sees it as 'true', and vice versa.
Test script:
---------------
PHP script
$xslDoc = new DOMDocument();
$xslDoc->load('Stubs/php-functions.xsl');
$xmlDoc = new DOMDocument();
$xmlDoc->load('Stubs/collection.xml');
$native = new \XSLTProcessor();
$native->importStylesheet($xslDoc);
$native->registerPHPFunctions();
$nativeResult = trim($native->transformToXML($xmlDoc));
$transpiler = new XsltProcessor();
$transpiler->importStylesheet($xslDoc);
$transpiler->registerPHPFunctions();
echo $transpiler->transformToXML($xmlDoc);
XML Document
<collection />
XSL Sheet
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:php="http://php.net/xsl">
<xsl:output method="xml"
indent="no"
omit-xml-declaration="yes"
encoding="UTF-8"/>
<xsl:template match="collection">
<xsl:value-of select="php:functionString('strpos', 'Hello',
'World')" />
</xsl:template>
</xsl:stylesheet>
Expected output: false
Actual output: true
Expected result:
----------------
false
Actual result:
--------------
true
--
Edit bug report at https://bugs.php.net/bug.php?id=70678&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70678&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70678&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70678&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70678&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70678&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70678&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70678&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70678&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70678&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70678&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70678&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70678&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70678&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70678&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70678&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70678&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70678&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70678&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70678&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70678&r=mysqlcfg
Thread (3 messages)
- f dot bosch at genkgo dot nl