Skip to content

Instantly share code, notes, and snippets.

@ircmaxell
Created February 9, 2015 22:05
Show Gist options
  • Save ircmaxell/21b56c9f9b7f8f3d09b3 to your computer and use it in GitHub Desktop.
Save ircmaxell/21b56c9f9b7f8f3d09b3 to your computer and use it in GitHub Desktop.
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 4f12834..8094dda 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -1189,12 +1189,10 @@ static zend_always_inline int zend_parse_arg_str(zval *arg, zend_string **dest,
if (check_null && UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
*dest = NULL;
} else {
- if (Z_COPYABLE_P(arg) && Z_REFCOUNT_P(arg) > 1) {
- Z_DELREF_P(arg);
- zval_copy_ctor_func(arg);
- }
- convert_to_string(arg);
- *dest = Z_STR_P(arg);
+ zval converted;
+ ZVAL_COPY_VALUE(&converted, arg);
+ convert_to_string(&converted);
+ *dest = Z_STR(converted);
}
} else if (UNEXPECTED(Z_TYPE_P(arg) != IS_OBJECT) ||
UNEXPECTED(parse_arg_object_to_str(arg, dest, IS_STRING) != SUCCESS)) {
@ralphschindler
Copy link

looks good!

@hikari-no-yume
Copy link

I'm not the one best placed to review this. @dstogov ?

@hikari-no-yume
Copy link

Oh, I can't ping people on Gist. Guess I'll have to make a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment