From 96fc48b606c60c72a0e956b058e19a44b3f3ad16 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 19 Jul 2004 14:55:35 +0000 Subject: [PATCH] Fixed bug #28985 (__getTypes() returning nothing on complex WSDL). --- NEWS | 1 + ext/soap/soap.c | 10 +- ext/soap/tests/bugs/bug28985.phpt | 204 +++++++++ ext/soap/tests/bugs/bug28985.wsdl | 683 ++++++++++++++++++++++++++++++ 4 files changed, 895 insertions(+), 3 deletions(-) create mode 100644 ext/soap/tests/bugs/bug28985.phpt create mode 100644 ext/soap/tests/bugs/bug28985.wsdl diff --git a/NEWS b/NEWS index 582c466a6c..2b1153f856 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2004, PHP 5.1.0 +- Fixed bug #28985 (__getTypes() returning nothing on complex WSDL). (Dmitry) - Fixed bug #29236 (memory error when wsdl-cache is enabled). (Dmitry) - Fixed bug #29109 (SoapFault exception: [WSDL] Out of memory). (Dmitry) - Fixed bug #29061 (soap extension segfaults). (Dmitry) diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 1125849dc8..fd21af7925 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -3749,8 +3749,12 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level) case XSD_TYPEKIND_SIMPLE: case XSD_TYPEKIND_LIST: case XSD_TYPEKIND_UNION: - smart_str_appendl(buf, type->encode->details.type_str, strlen(type->encode->details.type_str)); - smart_str_appendc(buf, ' '); + if (type->encode) { + smart_str_appendl(buf, type->encode->details.type_str, strlen(type->encode->details.type_str)); + smart_str_appendc(buf, ' '); + } else { + smart_str_appendl(buf, "anyType ", sizeof("anyType ")-1); + } smart_str_appendl(buf, type->name, strlen(type->name)); break; case XSD_TYPEKIND_COMPLEX: @@ -3775,7 +3779,7 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level) len = end-(*ext)->val; } if (len == 0) { - smart_str_appendl(buf, "anyType", 7); + smart_str_appendl(buf, "anyType", sizeof("anyType")-1); } else { smart_str_appendl(buf, (*ext)->val, len); } diff --git a/ext/soap/tests/bugs/bug28985.phpt b/ext/soap/tests/bugs/bug28985.phpt new file mode 100644 index 0000000000..291cce0cbb --- /dev/null +++ b/ext/soap/tests/bugs/bug28985.phpt @@ -0,0 +1,204 @@ +--TEST-- +Bug #28985 (__getTypes() returning nothing on complex WSDL) +--SKIPIF-- + +--FILE-- +1)); +var_dump($client->__getTypes()); +?> +--EXPECT-- +array(42) { + [0]=> + string(100) "struct LoginMGDIS { + string iUserLogin; + string iUserId; + string iUserPassword; + string iProfilId; +}" + [1]=> + string(29) "struct LoginMGDISResponse { +}" + [2]=> + string(28) "struct GetIdentification { +}" + [3]=> + string(77) "struct GetIdentificationResponse { + ArrayOfAnyType GetIdentificationResult; +}" + [4]=> + string(43) "struct ArrayOfAnyType { + anyType anyType; +}" + [5]=> + string(37) "struct RollbackCurrentTransaction { +}" + [6]=> + string(45) "struct RollbackCurrentTransactionResponse { +}" + [7]=> + string(68) "struct GetListeProfil { + string iUserLogin; + string iUserPassword; +}" + [8]=> + string(86) "struct MGCodeLibelle { + string Code; + string Libelle; + boolean Defaut; + anyType Tag; +}" + [9]=> + string(61) "struct ArrayOfMGCodeLibelle { + MGCodeLibelle MGCodeLibelle; +}" + [10]=> + string(77) "struct GetListeProfilResponse { + ArrayOfMGCodeLibelle GetListeProfilResult; +}" + [11]=> + string(41) "struct GetListeValCodif { + string Code; +}" + [12]=> + string(43) "struct ArrayOfMGCodif { + MGCodif MGCodif; +}" + [13]=> + string(18) "struct MGCodif { +}" + [14]=> + string(75) "struct GetListeValCodifResponse { + ArrayOfMGCodif GetListeValCodifResult; +}" + [15]=> + string(39) "struct TestPhpSoap { + MGCodif entree; +}" + [16]=> + string(57) "struct TestPhpSoapResponse { + string TestPhpSoapResult; +}" + [17]=> + string(50) "struct GetListeCodif { + boolean iGetListeValeur; +}" + [18]=> + string(87) "struct MGCodifGrp { + string TypeCodif; + string LibCodif; + ArrayOfMGCodif ListeCodifs; +}" + [19]=> + string(52) "struct ArrayOfMGCodifGrp { + MGCodifGrp MGCodifGrp; +}" + [20]=> + string(72) "struct GetListeCodifResponse { + ArrayOfMGCodifGrp GetListeCodifResult; +}" + [21]=> + string(57) "struct DroitCreation { + string iObjet; + string iProfil; +}" + [22]=> + string(62) "struct DroitCreationResponse { + boolean DroitCreationResult; +}" + [23]=> + string(74) "struct ListeDroitCreation { + ArrayOfString iListeObjet; + string iProfil; +}" + [24]=> + string(40) "struct ArrayOfString { + string string; +}" + [25]=> + string(79) "struct ListeDroitCreationResponse { + ArrayOfAnyType ListeDroitCreationResult; +}" + [26]=> + string(87) "struct GetDroitsObjetProtege { + string iObjet; + string iProfil; + string iUtilisateur; +}" + [27]=> + string(154) "struct MGDroitsObjetProtege { + string LbUti; + string LbProf; + string LbServ; + string LbDir; + boolean isProtected; + ArrayOfMGDroitAcces ListeDroitsAcces; +}" + [28]=> + string(58) "struct ArrayOfMGDroitAcces { + MGDroitAcces MGDroitAcces; +}" + [29]=> + string(104) "struct MGDroitAcces { + string IdProfil; + boolean Lecture; + boolean Modification; + boolean Suppression; +}" + [30]=> + string(91) "struct GetDroitsObjetProtegeResponse { + MGDroitsObjetProtege GetDroitsObjetProtegeResult; +}" + [31]=> + string(76) "struct GetPrivileges { + string iIdSupport; + int iIdForme; + string iProfil; +}" + [32]=> + string(68) "struct GetPrivilegesResponse { + ArrayOfString GetPrivilegesResult; +}" + [33]=> + string(46) "struct GetLibelleProfil { + string iIdProfil; +}" + [34]=> + string(67) "struct GetLibelleProfilResponse { + string GetLibelleProfilResult; +}" + [35]=> + string(91) "struct GetValeurRecherche { + string iChampSource; + string iTable; + string iOrderByClause; +}" + [36]=> + string(78) "struct GetValeurRechercheResponse { + ArrayOfString GetValeurRechercheResult; +}" + [37]=> + string(128) "struct GetValeurRechercheWithClauseWhere { + string iChampSource; + string iTable; + string iClauseWhere; + string iOrderByClause; +}" + [38]=> + string(108) "struct GetValeurRechercheWithClauseWhereResponse { + ArrayOfString GetValeurRechercheWithClauseWhereResult; +}" + [39]=> + string(27) "struct GetEnvironnement { +}" + [40]=> + string(106) "struct MGEnvironnement { + string RepBureautique; + string RepBureautiqueImage; + string RepBureautiqueDoc; +}" + [41]=> + string(76) "struct GetEnvironnementResponse { + MGEnvironnement GetEnvironnementResult; +}" +} \ No newline at end of file diff --git a/ext/soap/tests/bugs/bug28985.wsdl b/ext/soap/tests/bugs/bug28985.wsdl new file mode 100644 index 0000000000..ee528818bb --- /dev/null +++ b/ext/soap/tests/bugs/bug28985.wsdl @@ -0,0 +1,683 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.50.1