Skip to content

Commit d20cad1

Browse files
committed
cosmetic difference in expected error message in PHP4 vs PHP5.0/5.1 vs 5.2+... as such, split bug-9328.phpt into three tests;
git-svn-id: https://svn.php.net/repository/pear/packages/XML_Parser/trunk@287133 c90b9560-bf6c-de11-be94-00142212c4b1
1 parent 82bc936 commit d20cad1

File tree

5 files changed

+85
-1
lines changed

5 files changed

+85
-1
lines changed

package.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ Furthermore its now possible to split the parser from the handler object, so you
7272
<file role="test" name="005.phpt"/>
7373
<file role="test" name="AllTests.php"/>
7474
<file role="test" name="bug-9328.phpt"/>
75+
<file role="test" name="bug-9328b.phpt"/>
76+
<file role="test" name="bug-9328c.phpt"/>
7577
<file role="test" name="test2.xml"/>
7678
<file role="test" name="test3.xml"/>
7779
</dir> <!-- /tests -->

package2.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ Furthermore its now possible to split the parser from the handler object, so you
7777
<file baseinstalldir="XML" name="005.phpt" role="test" />
7878
<file baseinstalldir="XML" name="AllTests.php" role="test" />
7979
<file baseinstalldir="XML" name="bug-9328.phpt" role="test" />
80+
<file baseinstalldir="XML" name="bug-9328b.phpt" role="test" />
81+
<file baseinstalldir="XML" name="bug-9328c.phpt" role="test" />
8082
<file baseinstalldir="XML" name="test2.xml" role="test" />
8183
<file baseinstalldir="XML" name="test3.xml" role="test" />
8284
</dir> <!-- /tests -->

tests/bug-9328.phpt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
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.0.0', 'ge')) {
6+
print 'skip - test only applies to PHP4';
7+
}
8+
if (!extension_loaded('xml')) {
9+
print 'skip - xml extension not available';
10+
}
511
/*
612
* can't test if XML_RSS is not installed
713
*/
@@ -27,4 +33,4 @@ $error = $rss->parse();
2733
echo $error->getMessage() . PHP_EOL;
2834
?>
2935
--EXPECT--
30-
XML_Parser: Invalid document end at XML input line 1:1
36+
XML_Parser: syntax error at XML input line 1:0

tests/bug-9328b.phpt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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.0.0', 'lt')
6+
|| version_compare(PHP_VERSION, '5.2.0', 'ge')
7+
) {
8+
print 'skip - test only applies to PHP5.0.x and PHP5.1.x';
9+
}
10+
if (!extension_loaded('xml')) {
11+
print 'skip - xml extension not available';
12+
}
13+
/*
14+
* can't test if XML_RSS is not installed
15+
*/
16+
$originalErrorReporting = error_reporting();
17+
error_reporting(E_ALL & ~E_WARNING);
18+
if (false == (include_once 'XML/RSS.php')) {
19+
print('skip - XML_RSS is not installed');
20+
}
21+
error_reporting($originalErrorReporting);
22+
?>
23+
--FILE--
24+
<?php
25+
/*
26+
* this issue only exists in PHP4
27+
*/
28+
29+
require_once 'XML/RSS.php';
30+
31+
$url = 'www.someverybogusurl.com';
32+
$rss =& new XML_RSS($url);
33+
34+
$error = $rss->parse();
35+
echo $error->getMessage() . PHP_EOL;
36+
?>
37+
--EXPECT--
38+
XML_Parser: Empty document at XML input line 1:1

tests/bug-9328c.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.0', 'lt')) {
6+
print 'skip - test only applies to PHP5.2.x 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)