Skip to content

Commit

Permalink
restored if_not_ref calls
Browse files Browse the repository at this point in the history
  • Loading branch information
EmielBruijntjes committed Nov 6, 2023
1 parent 27ad89e commit b028a26
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions zend/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ Value &Value::setType(Type type) &
if (this->type() == type) return *this;

// if this is not a reference variable, we should detach it to implement copy on write
SEPARATE_ZVAL_NOREF(_val);
SEPARATE_ZVAL_IF_NOT_REF(_val);

// run the conversion, when it fails we throw a fatal error that ends up in PHP space
switch (type) {
Expand Down Expand Up @@ -1633,7 +1633,7 @@ Value Value::get(const char *key, int size) const
void Value::setRaw(int index, const Value &value)
{
// if this is not a reference variable, we should detach it to implement copy on write
SEPARATE_ZVAL_NOREF(_val);
SEPARATE_ZVAL_IF_NOT_REF(_val);

// add the value (this will decrement refcount on any current variable)
add_index_zval(_val, index, value._val);
Expand Down Expand Up @@ -1682,7 +1682,7 @@ void Value::setRaw(const char *key, int size, const Value &value)
if (isObject())
{
// if this is not a reference variable, we should detach it to implement copy on write
SEPARATE_ZVAL_NOREF(_val);
SEPARATE_ZVAL_IF_NOT_REF(_val);

// update the property
#if PHP_VERSION_ID < 70100
Expand All @@ -1700,7 +1700,7 @@ void Value::setRaw(const char *key, int size, const Value &value)
else
{
// if this is not a reference variable, we should detach it to implement copy on write
SEPARATE_ZVAL_NOREF(_val);
SEPARATE_ZVAL_IF_NOT_REF(_val);

// add the value (this will reduce the refcount of the current value)
add_assoc_zval_ex(_val, key, size, value._val);
Expand Down Expand Up @@ -1763,15 +1763,15 @@ void Value::unset(const char *key, int size)
if (isObject())
{
// if this is not a reference variable, we should detach it to implement copy on write
SEPARATE_ZVAL_NOREF(_val);
SEPARATE_ZVAL_IF_NOT_REF(_val);

// in the zend header files, unsetting properties is redirected to setting it to null...
add_property_null_ex(_val, key, size);
}
else if (isArray())
{
// if this is not a reference variable, we should detach it to implement copy on write
SEPARATE_ZVAL_NOREF(_val);
SEPARATE_ZVAL_IF_NOT_REF(_val);

// remove the index
zend_hash_del(Z_ARRVAL_P(_val.dereference()), String(key, size));
Expand Down

0 comments on commit b028a26

Please sign in to comment.