Skip to content

Fix property_exists() for XMLReader #16079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix possible memory leak
  • Loading branch information
kocsismate committed Sep 27, 2024
commit ffb41eaab6cb225dc7782ad45267dc6171ff9c68
13 changes: 10 additions & 3 deletions ext/xmlreader/php_xmlreader.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,19 @@ static int xmlreader_has_property(zend_object *object, zend_string *name, int ty
return 0;
}

bool result;

if (type == ZEND_PROPERTY_NOT_EMPTY) {
return zend_is_true(&rv);
result = zend_is_true(&rv);
} else if (type == ZEND_PROPERTY_ISSET) {
result = (Z_TYPE(rv) != IS_NULL);
} else {
ZEND_UNREACHABLE();
}

ZEND_ASSERT(type == ZEND_PROPERTY_ISSET);
return (Z_TYPE(rv) != IS_NULL);
zval_ptr_dtor(&rv);

return result;
}

return zend_std_has_property(object, name, type, cache_slot);
Expand Down