From aebb23e4dbfd9eee3f0ace6e37c876684aa62b20 Mon Sep 17 00:00:00 2001 From: Boro Sitnikovski Date: Thu, 26 Sep 2013 02:03:48 +0200 Subject: [PATCH 1/3] Bug 49898 __getCookies() method implementation --- ext/soap/soap.c | 23 +++++++++++++++++++++++ ext/soap/tests/bug49898.phpt | 14 ++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 ext/soap/tests/bug49898.phpt diff --git a/ext/soap/soap.c b/ext/soap/soap.c index ca7f206bdd0..eaa57d90328 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -225,6 +225,7 @@ PHP_METHOD(SoapClient, __getFunctions); PHP_METHOD(SoapClient, __getTypes); PHP_METHOD(SoapClient, __doRequest); PHP_METHOD(SoapClient, __setCookie); +PHP_METHOD(SoapClient, __getCookies); PHP_METHOD(SoapClient, __setLocation); PHP_METHOD(SoapClient, __setSoapHeaders); @@ -368,6 +369,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___setcookie, 0, 0, 1) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getcookies, 0) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___setsoapheaders, 0, 0, 1) ZEND_ARG_INFO(0, soapheaders) ZEND_END_ARG_INFO() @@ -422,6 +426,7 @@ static const zend_function_entry soap_client_functions[] = { PHP_ME(SoapClient, __getTypes, arginfo_soapclient___gettypes, 0) PHP_ME(SoapClient, __doRequest, arginfo_soapclient___dorequest, 0) PHP_ME(SoapClient, __setCookie, arginfo_soapclient___setcookie, 0) + PHP_ME(SoapClient, __getCookies, arginfo_soapclient___getcookies, 0) PHP_ME(SoapClient, __setLocation, arginfo_soapclient___setlocation, 0) PHP_ME(SoapClient, __setSoapHeaders, arginfo_soapclient___setsoapheaders, 0) PHP_FE_END @@ -3132,6 +3137,24 @@ PHP_METHOD(SoapClient, __setCookie) } /* }}} */ +/* {{{ proto array SoapClient::__getCookies ( void ) + Returns list of cookies */ +PHP_METHOD(SoapClient, __getCookies) +{ + zval **cookies, *tmp; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + array_init(return_value); + + if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) != FAILURE) { + zend_hash_copy(Z_ARRVAL_P(return_value), Z_ARRVAL_P(*cookies), (copy_ctor_func_t) zval_add_ref, (void *)&tmp, sizeof(zval*)); + } +} +/* }}} */ + /* {{{ proto void SoapClient::__setSoapHeaders(array SoapHeaders) Sets SOAP headers for subsequent calls (replaces any previous values). diff --git a/ext/soap/tests/bug49898.phpt b/ext/soap/tests/bug49898.phpt new file mode 100644 index 00000000000..eea4ea490a9 --- /dev/null +++ b/ext/soap/tests/bug49898.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test for bug #49898: SoapClient::__getCookies() implementation +--CREDITS-- +Boro Sitnikovski +--SKIPIF-- + +--FILE-- + 'mo:http://www.w3.org/', 'location' => 'http://some.url')); +$client->__setCookie("CookieTest", "HelloWorld"); +var_dump($client->__getCookies()['CookieTest'][0]); +?> +--EXPECT-- +string(10) "HelloWorld" From 9b5d56fd6117ea62fb86c968b0cce2f7c738f6b4 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 8 Jun 2014 19:38:07 -0700 Subject: [PATCH 2/3] add news --- NEWS | 3 +++ UPGRADING | 2 ++ 2 files changed, 5 insertions(+) diff --git a/NEWS b/NEWS index f98155f321f..512aba80246 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,9 @@ PHP NEWS . Fixed bug #66636 (openssl_x509_parse warning with V_ASN1_GENERALIZEDTIME). (Paul Oehler) +- SOAP: + . Implemented FR #49898 (Add SoapClient::__getCookies()). (Boro Sitnikovski) + - SPL: . Fixed bug #67359 (Segfault in recursiveDirectoryIterator). (Laruence) . Fixed bug #67360 (Missing element after ArrayObject::getIterator). (Adam) diff --git a/UPGRADING b/UPGRADING index 74f59e61362..80b6fb1aa62 100644 --- a/UPGRADING +++ b/UPGRADING @@ -373,6 +373,8 @@ PHP 5.4 UPGRADE NOTES - Added iterator support in MySQLi. mysqli_result implements Traversable. +- Since 5.4.30, SOAPClient has __getCookies() method. + ============================== 6. Changes to existing methods ============================== From 706324bf481a0be2f1e713e96c4506fc09162c92 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 8 Jun 2014 19:47:14 -0700 Subject: [PATCH 3/3] update news --- NEWS | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index f65f1699edd..69e5ecee304 100644 --- a/NEWS +++ b/NEWS @@ -3,19 +3,23 @@ PHP NEWS ?? ??? 2014, PHP 5.6.0 Release Candidate 1 - Core: + . Implemented FR #64744 (Differentiate between member function call on a null + and non-null, non-objects). (Boro Sitnikovski) . Fixed bug #66622 (Closures do not correctly capture the late bound class (static::) in some cases). (Levi Morrison) . Fixed bug #67390 (insecure temporary file use in the configure script). (Remi) (CVE-2014-3981) . Fixed bug #67392 (dtrace breaks argument unpack). (Nikita) - - OpenSSL: . Fixed bug #65698 (certificates validity parsing does not work past 2050). (Paul Oehler) . Fixed bug #66636 (openssl_x509_parse warning with V_ASN1_GENERALIZEDTIME). (Paul Oehler) +- SOAP: + . Implemented FR #49898 (Add SoapClient::__getCookies()). (Boro Sitnikovski) + - Tokenizer: . Fixed bug #67395 (token_name() does not return name for T_POW and T_POW_EQUAL token). (Ferenc)