2003-10-06 01:02:28 +00:00
|
|
|
--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";
|
2003-10-26 19:35:08 +00:00
|
|
|
$xml_file_valid = "$dir/bug25756_1.xml";
|
|
|
|
$xml_file_invalid = "$dir/bug25756_2.xml";
|
2003-10-06 01:02:28 +00:00
|
|
|
|
2003-10-26 19:35:08 +00:00
|
|
|
$s = simplexml_load_file($xml_file_valid);
|
2003-10-06 01:02:28 +00:00
|
|
|
var_dump($s);
|
|
|
|
var_dump($s->validate_schema_file($valid_schema_file));
|
|
|
|
var_dump($s->validate_schema_file($invalid_schema_file));
|
2003-10-26 19:35:08 +00:00
|
|
|
$s = simplexml_load_file($xml_file_invalid);
|
2003-10-06 01:02:28 +00:00
|
|
|
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) {
|
2003-10-06 01:02:28 +00:00
|
|
|
["items"]=>
|
2003-10-26 01:03:21 +00:00
|
|
|
object(simplexml_element)#%d (1) {
|
2003-10-06 01:02:28 +00:00
|
|
|
["item"]=>
|
|
|
|
array(2) {
|
|
|
|
[0]=>
|
2003-10-26 01:03:21 +00:00
|
|
|
object(simplexml_element)#%d (2) {
|
2003-10-06 01:02:28 +00:00
|
|
|
["product-name"]=>
|
|
|
|
string(3) "abc"
|
|
|
|
["quantity"]=>
|
|
|
|
string(3) "123"
|
|
|
|
}
|
|
|
|
[1]=>
|
2003-10-26 01:03:21 +00:00
|
|
|
object(simplexml_element)#%d (2) {
|
2003-10-06 01:02:28 +00:00
|
|
|
["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) {
|
2003-10-06 01:02:28 +00:00
|
|
|
["items"]=>
|
2003-10-26 01:03:21 +00:00
|
|
|
object(simplexml_element)#%d (1) {
|
2003-10-06 01:02:28 +00:00
|
|
|
["item"]=>
|
|
|
|
array(2) {
|
|
|
|
[0]=>
|
2003-10-26 01:03:21 +00:00
|
|
|
object(simplexml_element)#%d (2) {
|
2003-10-06 01:02:28 +00:00
|
|
|
["product-name"]=>
|
|
|
|
string(3) "abc"
|
|
|
|
["quantity"]=>
|
|
|
|
string(3) "abc"
|
|
|
|
}
|
|
|
|
[1]=>
|
2003-10-26 01:03:21 +00:00
|
|
|
object(simplexml_element)#%d (2) {
|
2003-10-06 01:02:28 +00:00
|
|
|
["product-name"]=>
|
|
|
|
string(3) "abc"
|
|
|
|
["quantity"]=>
|
|
|
|
string(3) "123"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-10-26 19:35:08 +00:00
|
|
|
|
|
|
|
Warning: Element quantity: failed to validate basic type decimal in %s on line %d
|
2003-10-26 01:17:51 +00:00
|
|
|
bool(false)
|