Bug #68946 [Opn]: simplexml_load_string() result depends on formatting of xml string
Edit report at https://bugs.php.net/bug.php?id=68946&edit=1
ID: 68946
User updated by: danielhintermann at yahoo dot de
Reported by: danielhintermann at yahoo dot de
Summary: simplexml_load_string() result depends on formatting
of xml string
Status: Open
Type: Bug
Package: SimpleXML related
Operating System: Windows
PHP Version: 5.6.5
Block user comment: N
Private report: N
New Comment:
Could be a duplicate of #68507.
Previous Comments:
------------------------------------------------------------------------
[2015-01-29 15:29:03] danielhintermann at yahoo dot de
Description:
------------
First, the bug could also be triggered on PHP version 5.3.28 on windows.
Secondly, it could be related to the issue Bug #61335.
Depending on formatting of a xml string the comparing with '== false' gives different
result. It is clear that the === operator should be used, however, the == operator still should give
consistent results!
Test script:
---------------
<?php
class TestComparisonOperator extends PHPUnit_Framework_TestCase {
public function testWithoutSpaceFormat() {
$oXml = simplexml_load_string($this->getXmlNoFormatting());
var_dump($oXml);
$this->assertFalse($oXml == false);
}
public function testWithSpaceFormat() {
$oXml = simplexml_load_string($this->getXmlWithSpaceFormat());
var_dump($oXml);
$this->assertFalse($oXml == false);
}
private function getXmlNoFormatting()
{
return "<?BrightCloud
version=bcap/1.1?><bcap><seqnum>1</seqnum></bcap>";
}
private function getXmlWithSpaceFormat()
{
// look at the space after bcap tag!
return "<?BrightCloud version=bcap/1.1?><bcap>
<seqnum>1</seqnum></bcap>";
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68946&edit=1
Thread (7 messages)