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
parent 7af3bcb4bc
commit 96d1640a37
No known key found for this signature in database
GPG Key ID: 36E3664E099D0614
1 changed files with 1 additions and 1 deletions

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;
}