php-src/ext/simplexml/tests/bug25756.phpt

69 lines
1.5 KiB
Plaintext
Raw Normal View History

--TEST--
Bug #25756 (validate_schema_file() broken)
--FILE--
<?php
$dir = dirname(__FILE__);
$valid_schema_file = "$dir/bug25756.xsd";
$invalid_schema_file = "$dir/bug25756_1.xml";
$xml_file_1 = "$dir/bug25756_1.xml";
$xml_file_2 = "$dir/bug25756_2.xml";
$s = simplexml_load_file($xml_file_1);
var_dump($s);
var_dump($s->validate_schema_file($valid_schema_file));
var_dump($s->validate_schema_file($invalid_schema_file));
$s = simplexml_load_file($xml_file_2);
var_dump($s);
var_dump($s->validate_schema_file($valid_schema_file));
?>
--EXPECTF--
2003-10-26 01:03:21 +00:00
object(simplexml_element)#%d (1) {
["items"]=>
2003-10-26 01:03:21 +00:00
object(simplexml_element)#%d (1) {
["item"]=>
array(2) {
[0]=>
2003-10-26 01:03:21 +00:00
object(simplexml_element)#%d (2) {
["product-name"]=>
string(3) "abc"
["quantity"]=>
string(3) "123"
}
[1]=>
2003-10-26 01:03:21 +00:00
object(simplexml_element)#%d (2) {
["product-name"]=>
string(3) "def"
["quantity"]=>
string(3) "456"
}
}
}
}
bool(true)
Warning: Unknown: Malformed XML Schema in %s on line %d
bool(false)
2003-10-26 01:03:21 +00:00
object(simplexml_element)#%d (1) {
["items"]=>
2003-10-26 01:03:21 +00:00
object(simplexml_element)#%d (1) {
["item"]=>
array(2) {
[0]=>
2003-10-26 01:03:21 +00:00
object(simplexml_element)#%d (2) {
["product-name"]=>
string(3) "abc"
["quantity"]=>
string(3) "abc"
}
[1]=>
2003-10-26 01:03:21 +00:00
object(simplexml_element)#%d (2) {
["product-name"]=>
string(3) "abc"
["quantity"]=>
string(3) "123"
}
}
}
}
2003-10-26 01:17:51 +00:00
bool(false)