1--TEST-- 2Bug #62900 (Wrong namespace on xsd import error message) 3--EXTENSIONS-- 4soap 5--INI-- 6soap.wsdl_cache_enabled=0 7--FILE-- 8<?php 9 10$wsdl_with_ns = <<<XML 11<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://test-uri"> 12 <types> 13 <xs:schema targetNamespace="http://test-uri" elementFormDefault="qualified"> 14 <import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="bug62900.xsd" /> 15 </xs:schema> 16 </types> 17</definitions> 18XML; 19 20$wsdl_without_ns = <<<XML 21<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://test-uri"> 22 <types> 23 <xs:schema elementFormDefault="qualified"> 24 <import schemaLocation="bug62900.xsd" /> 25 </xs:schema> 26 </types> 27</definitions> 28XML; 29 30$xsd_with_wrong_ns = <<<XML 31<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd"> 32<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespacex" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="en"/> 33XML; 34 35$xsd_without_ns = <<<XML 36<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd"> 37<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="en"/> 38XML; 39 40$combinations = [ 41 [$wsdl_with_ns, $xsd_with_wrong_ns], 42 [$wsdl_with_ns, $xsd_without_ns], 43 [$wsdl_without_ns, $xsd_with_wrong_ns], 44 [$wsdl_without_ns, $xsd_without_ns], 45]; 46 47chdir(__DIR__); 48 49$args = ["-d", "display_startup_errors=0", "-d", "extension_dir=" . ini_get("extension_dir"), "-d", "extension=" . (substr(PHP_OS, 0, 3) == "WIN" ? "php_" : "") . "soap." . PHP_SHLIB_SUFFIX]; 50if (php_ini_loaded_file()) { 51 // Necessary such that it works from a development directory in which case extension_dir might not be the real extension dir 52 $args[] = "-c"; 53 $args[] = php_ini_loaded_file(); 54} 55 56foreach ($combinations as list($wsdl, $xsd)) { 57 file_put_contents(__DIR__."/bug62900.wsdl", $wsdl); 58 file_put_contents(__DIR__."/bug62900.xsd", $xsd); 59 60 $proc = proc_open([PHP_BINARY, ...$args, __DIR__.'/bug62900_run'], [1 => ["pipe", "w"], 2 => ["pipe", "w"]], $pipes); 61 echo stream_get_contents($pipes[1]); 62 fclose($pipes[1]); 63 proc_close($proc); 64} 65 66?> 67--CLEAN-- 68<?php 69@unlink(__DIR__."/bug62900.wsdl"); 70@unlink(__DIR__."/bug62900.xsd"); 71?> 72--EXPECTF-- 73Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: can't import schema from '%sbug62900.xsd', unexpected 'targetNamespace'='http://www.w3.org/XML/1998/namespacex', expected 'http://www.w3.org/XML/1998/namespace' in %s:%d 74Stack trace: 75#0 %s(%d): SoapClient->__construct(%s) 76#1 {main} 77 thrown in %s on line %d 78 79Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: can't import schema from '%sbug62900.xsd', missing 'targetNamespace', expected 'http://www.w3.org/XML/1998/namespace' in %s:%d 80Stack trace: 81#0 %s(%d): SoapClient->__construct(%s) 82#1 {main} 83 thrown in %s on line %d 84 85Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: can't import schema from '%sbug62900.xsd', unexpected 'targetNamespace'='http://www.w3.org/XML/1998/namespacex', expected no 'targetNamespace' in %s:%d 86Stack trace: 87#0 %s(%d): SoapClient->__construct(%s) 88#1 {main} 89 thrown in %s on line %d 90 91Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't bind to service in %s:%d 92Stack trace: 93#0 %s(%d): SoapClient->__construct(%s) 94#1 {main} 95 thrown in %s on line %d 96