com php-src: Only persistent referencecounted strings should be duplicated.: ext/standard/browscap.c
| From: | Dmitry Stogov | Date: | Fri, 19 Jan 2018 10:41:35 +0000 |
| Subject: | com php-src: Only persistent referencecounted strings should be duplicated.: ext/standard/browscap.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100963@lists.php.net to get a copy of this message | ||
Commit: 41ef2952c866e34a51185d26b1e105016e9c5108
Author: Dmitry Stogov <dmitry@zend.com> Fri, 19 Jan 2018 13:41:35 +0300
Parents: d8f916124b9bc4e8fa1f0d10fc95bcab09115d50
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=41ef2952c866e34a51185d26b1e105016e9c5108
Log:
Only persistent referencecounted strings should be duplicated.
Changed paths:
M ext/standard/browscap.c
Diff:
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
index e58a20c..60c0127 100644
--- a/ext/standard/browscap.c
+++ b/ext/standard/browscap.c
@@ -688,7 +688,17 @@ static int browser_reg_compare(
static void browscap_zval_copy_ctor(zval *p) /* {{{ */
{
- zval_copy_ctor(p);
+ if (Z_REFCOUNTED_P(p)) {
+ zend_string *str;
+
+ ZEND_ASSERT(Z_TYPE_P(p) == IS_STRING);
+ str = Z_STR_P(p);
+ if (!(GC_FLAGS(str) & GC_PERSISTENT)) {
+ GC_ADDREF(str);
+ } else {
+ ZVAL_NEW_STR(p, zend_string_init(ZSTR_VAL(str), ZSTR_LEN(str), 0));
+ }
+ }
}
/* }}} */