Bug #70678 [Com]: PHP7 returns true when false is expected

From: Date: Fri, 09 Oct 2015 14:23:05 +0000
Subject: Bug #70678 [Com]: PHP7 returns true when false is expected
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196469@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70678&edit=1

 ID:                 70678
 Comment by:         f dot bosch at genkgo dot nl
 Reported by:        f dot bosch at genkgo dot nl
 Summary:            PHP7 returns true when false is expected
 Status:             Open
 Type:               Bug
 Package:            XSLT related
 Operating System:   worker-linux-docker
 PHP Version:        7.0.0RC4
 Block user comment: N
 Private report:     N

 New Comment:

It is not vice versa as been suggested in the original post.


Previous Comments:
------------------------------------------------------------------------
[2015-10-09 14:21:15] f dot bosch at genkgo dot nl

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 this bug report at https://bugs.php.net/bug.php?id=70678&edit=1


Thread (1 message)

  • f dot bosch at genkgo dot nl
  • Unknown Message
    • f dot bosch at genkgo dot nl
« previous php.bugs (#196469) next »