Skip to content

Commit f6651b7

Browse files
committed
Code review responses
* Always destroy zval * Fix all-caps null * Use EXTENSIONS section in test
1 parent 3a44824 commit f6651b7

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

ext/libxml/libxml.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -840,10 +840,8 @@ static PHP_RINIT_FUNCTION(libxml)
840840
static PHP_RSHUTDOWN_FUNCTION(libxml)
841841
{
842842
LIBXML(entity_loader).fci.size = 0;
843-
if (!Z_ISNULL(LIBXML(entity_loader).callback)) {
844-
zval_ptr_dtor_nogc(&LIBXML(entity_loader).callback);
845-
ZVAL_NULL(&LIBXML(entity_loader).callback);
846-
}
843+
zval_ptr_dtor_nogc(&LIBXML(entity_loader).callback);
844+
ZVAL_NULL(&LIBXML(entity_loader).callback);
847845

848846
return SUCCESS;
849847
}
@@ -1079,7 +1077,7 @@ PHP_FUNCTION(libxml_set_external_entity_loader)
10791077
fci.object = NULL;
10801078
fci.named_params = NULL;
10811079
if (zend_fcall_info_init(callback, 0, &fci, &fcc, NULL, &error) != SUCCESS) {
1082-
zend_argument_type_error(1, "must be a valid callback or NULL, %s", error);
1080+
zend_argument_type_error(1, "must be a valid callback or null, %s", error);
10831081
RETURN_THROWS();
10841082
}
10851083
LIBXML(entity_loader).fci = fci;

ext/libxml/tests/libxml_get_external_entity_loader.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--TEST--
22
libxml_get_external_entity_loader() returns current handler
3-
--SKIPIF--
4-
<?php if (!extension_loaded('dom')) die('skip dom extension not available'); ?>
3+
--EXTENSIONS--
4+
libxml
55
--FILE--
66
<?php
77

ext/libxml/tests/libxml_set_external_entity_loader_error2.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ try {
1111
}
1212
?>
1313
--EXPECT--
14-
Exception: libxml_set_external_entity_loader(): Argument #1 ($resolver_function) must be a valid callback or NULL, function "nonexistent_function" not found or invalid function name
14+
Exception: libxml_set_external_entity_loader(): Argument #1 ($resolver_function) must be a valid callback or null, function "nonexistent_function" not found or invalid function name

0 commit comments

Comments
 (0)