Use strpos to check that @ is the first char

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
Daniel Kesselberg 2020-01-16 14:09:25 +01:00 committed by Backportbot
parent 2a5ae7ab48
commit 2b11da251e

View file

@ -126,7 +126,7 @@ abstract class BaseResponse extends Response {
*/
protected function toXML(array $array, \XMLWriter $writer) {
foreach ($array as $k => $v) {
if ($k[0] === '@') {
if (\is_string($k) && strpos($k, '@') === 0) {
$writer->writeAttribute(substr($k, 1), $v);
continue;
}