1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

ext/soap: SoapClient::__setCookie() to deal with name as digits. (#20526)

This commit is contained in:
David CARLIER
2025-11-20 19:22:15 +00:00
committed by GitHub
parent c0cf84158f
commit 4e2bd0c5b7
2 changed files with 24 additions and 2 deletions

View File

@@ -2835,12 +2835,12 @@ PHP_METHOD(SoapClient, __setCookie)
zval *cookies = Z_CLIENT_COOKIES_P(ZEND_THIS);
SEPARATE_ARRAY(cookies);
if (val == NULL) {
zend_hash_del(Z_ARRVAL_P(cookies), name);
zend_symtable_del(Z_ARRVAL_P(cookies), name);
} else {
zval zcookie;
array_init(&zcookie);
add_index_str(&zcookie, 0, zend_string_copy(val));
zend_hash_update(Z_ARRVAL_P(cookies), name, &zcookie);
zend_symtable_update(Z_ARRVAL_P(cookies), name, &zcookie);
}
}
/* }}} */

View File

@@ -0,0 +1,22 @@
--TEST--
SoapClient::__setCookie with numeric keys
--EXTENSIONS--
soap
--FILE--
<?php
$client = new SoapClient(null, array('uri' => 'mo:http://www.w3.org/', 'location' => 'http://example.com'));
$client->__setCookie("123", "456");
var_dump($client->__getCookies());
$client->__setCookie("123", NULL);
var_dump($client->__getCookies());
?>
--EXPECT--
array(1) {
[123]=>
array(1) {
[0]=>
string(3) "456"
}
}
array(0) {
}