mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Declare php_user_filter::$stream property
This property is temporarily set during the filter() call. I have no idea why this wasn't added as an argument to filter() instead.
This commit is contained in:
parent
7f7a90b2bc
commit
05a217927a
3 changed files with 17 additions and 13 deletions
|
@ -148,7 +148,6 @@ php_stream_filter_status_t userfilter_filter(
|
|||
zval func_name;
|
||||
zval retval;
|
||||
zval args[4];
|
||||
zend_string *propname;
|
||||
int call_result;
|
||||
|
||||
/* the userfilter object probably doesn't exist anymore */
|
||||
|
@ -156,15 +155,12 @@ php_stream_filter_status_t userfilter_filter(
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (!zend_hash_str_exists_ind(Z_OBJPROP_P(obj), "stream", sizeof("stream")-1)) {
|
||||
zval tmp;
|
||||
|
||||
zval *stream_prop = zend_hash_str_find_ind(Z_OBJPROP_P(obj), "stream", sizeof("stream")-1);
|
||||
if (stream_prop) {
|
||||
/* Give the userfilter class a hook back to the stream */
|
||||
php_stream_to_zval(stream, &tmp);
|
||||
Z_ADDREF(tmp);
|
||||
add_property_zval(obj, "stream", &tmp);
|
||||
/* add_property_zval increments the refcount which is unwanted here */
|
||||
zval_ptr_dtor(&tmp);
|
||||
zval_ptr_dtor(stream_prop);
|
||||
php_stream_to_zval(stream, stream_prop);
|
||||
Z_ADDREF_P(stream_prop);
|
||||
}
|
||||
|
||||
ZVAL_STRINGL(&func_name, "filter", sizeof("filter")-1);
|
||||
|
@ -223,9 +219,9 @@ php_stream_filter_status_t userfilter_filter(
|
|||
/* filter resources are cleaned up by the stream destructor,
|
||||
* keeping a reference to the stream resource here would prevent it
|
||||
* from being destroyed properly */
|
||||
propname = zend_string_init("stream", sizeof("stream")-1, 0);
|
||||
Z_OBJ_HANDLER_P(obj, unset_property)(Z_OBJ_P(obj), propname, NULL);
|
||||
zend_string_release_ex(propname, 0);
|
||||
if (stream_prop) {
|
||||
convert_to_null(stream_prop);
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&args[3]);
|
||||
zval_ptr_dtor(&args[2]);
|
||||
|
|
|
@ -6,6 +6,8 @@ class php_user_filter
|
|||
{
|
||||
public string $filtername = "";
|
||||
public mixed $params = "";
|
||||
/** @var resource|null */
|
||||
public $stream = null;
|
||||
|
||||
/**
|
||||
* @param resource $in
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 13972748dca10a1c291f952b4c24ca73441ba880 */
|
||||
* Stub hash: c7ae14efaeb0e8f5fdd6ddf92574a35bd5c860a1 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_php_user_filter_filter, 0, 4, IS_LONG, 0)
|
||||
ZEND_ARG_INFO(0, in)
|
||||
|
@ -46,5 +46,11 @@ static zend_class_entry *register_class_php_user_filter(void)
|
|||
zend_declare_typed_property(class_entry, property_params_name, &property_params_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ANY));
|
||||
zend_string_release(property_params_name);
|
||||
|
||||
zval property_stream_default_value;
|
||||
ZVAL_NULL(&property_stream_default_value);
|
||||
zend_string *property_stream_name = zend_string_init("stream", sizeof("stream") - 1, 1);
|
||||
zend_declare_property_ex(class_entry, property_stream_name, &property_stream_default_value, ZEND_ACC_PUBLIC, NULL);
|
||||
zend_string_release(property_stream_name);
|
||||
|
||||
return class_entry;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue