Repository navigation
Conversation
| } | ||
| } | ||
| $c = new C(null, ["location" => "test://", "uri" => "test://"]); | ||
| $c->foo(new SoapVar(["a" => new SoapVar("x", XSD_STRING), new SoapVar("y", XSD_STRING)], XSD_ANYXML)); |
There was a problem hiding this comment.
With the integer key last, the caller renames the returned node to param0, so the test doesn't show what an integer-keyed element becomes. Putting it first ([new SoapVar("y", XSD_STRING), "a" => ...]) pins the <BOGUS> name it actually gets.
There was a problem hiding this comment.
Done in e5ff8d3, the integer-keyed element now comes first and the test expects <BOGUS>.
to_xml_any() renamed each output node after its array key, but an integer key has no zend_string, so ZSTR_VAL() dereferenced NULL. Rename only for string keys, as to_xml_object() does, so an integer-keyed element keeps its default name. Fixes phpGH-25267 Closes phpGH-25270
e5ff8d3 to
11f3ded
Compare
|
This fixes the crash, but is this semantically correct though? We now have a BOGUS element in the resulting XML. Does the name "BOGUS" not mean anything anymore ? ;) |
|
Not really, BOGUS is just the placeholder name the encoder gives a node before the caller renames it, and nothing renames it here. It's also what PHP 5.6 did before the string-key check got lost in the PHP 7 port, but since integer keys have crashed ever since, nobody can depend on it, so on master it could just throw for a non-string key instead. I can send that if you think it's better. |
|
You should check the soap spec to see what should happen. |
to_xml_any()renames each node after its array key, but an integer key gives a NULLzend_stringandZSTR_VAL()crashes on it. Now it only renames for string keys, the same wayto_xml_object()handles them, so an integer-keyed element keeps its default name.Fixes #25267