Skip to content

Commit 4e2bd0c

Browse files
authored
ext/soap: SoapClient::__setCookie() to deal with name as digits. (#20526)
1 parent c0cf841 commit 4e2bd0c

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

ext/soap/soap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2835,12 +2835,12 @@ PHP_METHOD(SoapClient, __setCookie)
28352835
zval *cookies = Z_CLIENT_COOKIES_P(ZEND_THIS);
28362836
SEPARATE_ARRAY(cookies);
28372837
if (val == NULL) {
2838-
zend_hash_del(Z_ARRVAL_P(cookies), name);
2838+
zend_symtable_del(Z_ARRVAL_P(cookies), name);
28392839
} else {
28402840
zval zcookie;
28412841
array_init(&zcookie);
28422842
add_index_str(&zcookie, 0, zend_string_copy(val));
2843-
zend_hash_update(Z_ARRVAL_P(cookies), name, &zcookie);
2843+
zend_symtable_update(Z_ARRVAL_P(cookies), name, &zcookie);
28442844
}
28452845
}
28462846
/* }}} */
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
SoapClient::__setCookie with numeric keys
3+
--EXTENSIONS--
4+
soap
5+
--FILE--
6+
<?php
7+
$client = new SoapClient(null, array('uri' => 'mo:http://www.w3.org/', 'location' => 'http://example.com'));
8+
$client->__setCookie("123", "456");
9+
var_dump($client->__getCookies());
10+
$client->__setCookie("123", NULL);
11+
var_dump($client->__getCookies());
12+
?>
13+
--EXPECT--
14+
array(1) {
15+
[123]=>
16+
array(1) {
17+
[0]=>
18+
string(3) "456"
19+
}
20+
}
21+
array(0) {
22+
}

0 commit comments

Comments
 (0)