Bug #68267 [NEW]: Analysis of the problem
| From: | ian dot email at qq dot com | Date: | Mon, 20 Oct 2014 07:17:17 +0000 |
| Subject: | Bug #68267 [NEW]: Analysis of the problem | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-188192@lists.php.net to get a copy of this message | ||
From: ian dot email at qq dot com
Operating system: win7/centos
PHP version: 5.6.2
Package: DOM XML related
Bug Type: Bug
Bug description:Analysis of the problem
Description:
------------
<?xml version="1.0" encoding="UTF-8"?>
<web>
<seo>
<theme/>
<keys>keys</keys>
<title>title</title>
<desc>desc</desc>
<banner>banner</banner>
</seo>
<upload>
<img>
<size>1000</size>
<type>
bmp,gif,jpg,png,jpeg
</type>
<show>
thumb:60*60|norm:320*320|zoom:512*512
</show>
</img>
</upload>
</web>
$xml = new \DomDocument('1.0', 'UTF-8');
$xml->load('web.xml');
$notes = $xml->getElementsByTagName('img');
for ($index = 0; $index < $notes->length; $index++) {
foreach ($notes->item($index)->childNodes as $nv){
if($nv->nodeType == XML_ELEMENT_NODE)
echo $nv->nodeName.'=>'.$nv->nodeValue.'<br />';
}
}
Test script:
---------------
<?xml version="1.0" encoding="UTF-8"?>
<web>
<seo>
<theme/>
<keys>keys</keys>
<title>title</title>
<desc>desc</desc>
<banner>banner</banner>
</seo>
<upload>
<img>
<size>1000</size>
<type>
bmp,gif,jpg,png,jpeg
</type>
<show>
thumb:60*60|norm:320*320|zoom:512*512
</show>
</img>
</upload>
</web>
$xml = new \DomDocument('1.0', 'UTF-8');
$xml->load('web.xml');
$notes = $xml->getElementsByTagName('img');
for ($index = 0; $index < $notes->length; $index++) {
foreach ($notes->item($index)->childNodes as $nv){
if($nv->nodeType == XML_ELEMENT_NODE)
echo $nv->nodeName.'=>'.$nv->nodeValue.'<br />';
}
}
Expected result:
----------------
$notes = $xml->getElementsByTagName('img'); Cycle number is wrong
$notes = $xml->getElementsByTagName('size'); Results cannot be obtained
Actual result:
--------------
win7:
size=>1000
type=> bmp,gif,jpg,png,jpeg
show=> thumb:60*60|norm:320*320|zoom:512*512
centOS:
size=>1000
type=> bmp,gif,jpg,png,jpeg
show=> thumb:60*60|norm:320*320|zoom:512*512
size=>1000
type=> bmp,gif,jpg,png,jpeg
show=> thumb:60*60|norm:320*320|zoom:512*512
size=>1000
type=> bmp,gif,jpg,png,jpeg
show=> thumb:60*60|norm:320*320|zoom:512*512
size=>1000
type=> bmp,gif,jpg,png,jpeg
show=> thumb:60*60|norm:320*320|zoom:512*512
size=>1000
type=> bmp,gif,jpg,png,jpeg
show=> thumb:60*60|norm:320*320|zoom:512*512
--
Edit bug report at https://bugs.php.net/bug.php?id=68267&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68267&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68267&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68267&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68267&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68267&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68267&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68267&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68267&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68267&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68267&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68267&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68267&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68267&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68267&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68267&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68267&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68267&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68267&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68267&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68267&r=mysqlcfg