mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
if you pass NULL as the resource_type_name to zend_fetch_resource*&friends the functions will not print any warnings if the resource is not found!
This commit is contained in:
parent
8b4000f4cb
commit
5f3515652a
1 changed files with 6 additions and 3 deletions
|
@ -154,9 +154,11 @@ ZEND_API void *zend_fetch_resource_ex(zval *passed_id, int default_id, char *res
|
||||||
|
|
||||||
if (default_id==-1) { /* use id */
|
if (default_id==-1) { /* use id */
|
||||||
if (!passed_id) {
|
if (!passed_id) {
|
||||||
|
if (resource_type_name)
|
||||||
zend_error(E_WARNING, "No %s resource supplied", resource_type_name);
|
zend_error(E_WARNING, "No %s resource supplied", resource_type_name);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (passed_id->type != IS_RESOURCE) {
|
} else if (passed_id->type != IS_RESOURCE) {
|
||||||
|
if (resource_type_name)
|
||||||
zend_error(E_WARNING, "Supplied argument is not a valid %s resource", resource_type_name);
|
zend_error(E_WARNING, "Supplied argument is not a valid %s resource", resource_type_name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -167,6 +169,7 @@ ZEND_API void *zend_fetch_resource_ex(zval *passed_id, int default_id, char *res
|
||||||
|
|
||||||
resource = zend_list_find(id, &actual_resource_type);
|
resource = zend_list_find(id, &actual_resource_type);
|
||||||
if (!resource) {
|
if (!resource) {
|
||||||
|
if (resource_type_name)
|
||||||
zend_error(E_WARNING, "%d is not a valid %s resource", id, resource_type_name);
|
zend_error(E_WARNING, "%d is not a valid %s resource", id, resource_type_name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue