Skip to content

Commit daef24c

Browse files
committed
another cosmetic difference in error message, in the early 5.2.x vs newer 5.2.x
git-svn-id: https://svn.php.net/repository/pear/packages/XML_Parser/trunk@287134 c90b9560-bf6c-de11-be94-00142212c4b1
1 parent d20cad1 commit daef24c

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Furthermore its now possible to split the parser from the handler object, so you
7474
<file role="test" name="bug-9328.phpt"/>
7575
<file role="test" name="bug-9328b.phpt"/>
7676
<file role="test" name="bug-9328c.phpt"/>
77+
<file role="test" name="bug-9328d.phpt"/>
7778
<file role="test" name="test2.xml"/>
7879
<file role="test" name="test3.xml"/>
7980
</dir> <!-- /tests -->

package2.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Furthermore its now possible to split the parser from the handler object, so you
7979
<file baseinstalldir="XML" name="bug-9328.phpt" role="test" />
8080
<file baseinstalldir="XML" name="bug-9328b.phpt" role="test" />
8181
<file baseinstalldir="XML" name="bug-9328c.phpt" role="test" />
82+
<file baseinstalldir="XML" name="bug-9328d.phpt" role="test" />
8283
<file baseinstalldir="XML" name="test2.xml" role="test" />
8384
<file baseinstalldir="XML" name="test3.xml" role="test" />
8485
</dir> <!-- /tests -->

tests/bug-9328c.phpt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
XML Parser: test for Bug #9328 "assigned by reference error in XML_RSS parse"
33
--SKIPIF--
44
<?php
5-
if (version_compare(PHP_VERSION, '5.2.0', 'lt')) {
6-
print 'skip - test only applies to PHP5.2.x and higher';
5+
if (version_compare(PHP_VERSION, '5.2.0', 'lt')
6+
|| version_compare(PHP_VERSION, '5.2.10', 'ge')
7+
) {
8+
print 'skip - test only applies to PHP5.2.x earlier than 5.2.10';
79
}
810
if (!extension_loaded('xml')) {
911
print 'skip - xml extension not available';
@@ -33,4 +35,4 @@ $error = $rss->parse();
3335
echo $error->getMessage() . PHP_EOL;
3436
?>
3537
--EXPECT--
36-
XML_Parser: Not well-formed (invalid token) at XML input line 1:1
38+
XML_Parser: Invalid document end at XML input line 1:1

tests/bug-9328d.phpt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
--TEST--
2+
XML Parser: test for Bug #9328 "assigned by reference error in XML_RSS parse"
3+
--SKIPIF--
4+
<?php
5+
if (version_compare(PHP_VERSION, '5.2.10', 'lt')) {
6+
print 'skip - test only applies to PHP5.2.10 and higher';
7+
}
8+
if (!extension_loaded('xml')) {
9+
print 'skip - xml extension not available';
10+
}
11+
/*
12+
* can't test if XML_RSS is not installed
13+
*/
14+
$originalErrorReporting = error_reporting();
15+
error_reporting(E_ALL & ~E_WARNING);
16+
if (false == (include_once 'XML/RSS.php')) {
17+
print('skip - XML_RSS is not installed');
18+
}
19+
error_reporting($originalErrorReporting);
20+
?>
21+
--FILE--
22+
<?php
23+
/*
24+
* this issue only exists in PHP4
25+
*/
26+
27+
require_once 'XML/RSS.php';
28+
29+
$url = 'www.someverybogusurl.com';
30+
$rss =& new XML_RSS($url);
31+
32+
$error = $rss->parse();
33+
echo $error->getMessage() . PHP_EOL;
34+
?>
35+
--EXPECT--
36+
XML_Parser: Not well-formed (invalid token) at XML input line 1:1

0 commit comments

Comments
 (0)