com php-src: IS_REFERENCE with refcount==1 should be handled as ordinal value: Zend/zend_variabl es.c ext/standard/var.c
| From: | Dmitry Stogov | Date: | Thu, 06 Mar 2014 08:37:46 +0000 |
| Subject: | com php-src: IS_REFERENCE with refcount==1 should be handled as ordinal value: Zend/zend_variabl es.c ext/standard/var.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77723@lists.php.net to get a copy of this message | ||
Commit: 2eb980f614ab59aa8f632ae5a70f719f34e8410f
Author: Dmitry Stogov <dmitry@zend.com> Thu, 6 Mar 2014 12:37:46 +0400
Parents: f3b4b1688314caa6f3dc32ef6aa796642c408d1f
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2eb980f614ab59aa8f632ae5a70f719f34e8410f
Log:
IS_REFERENCE with refcount==1 should be handled as ordinal value
Changed paths:
M Zend/zend_variables.c
M ext/standard/var.c
Diff:
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
index 7fd42b2..47b07ee 100644
--- a/Zend/zend_variables.c
+++ b/Zend/zend_variables.c
@@ -188,7 +188,12 @@ ZEND_API void _zval_internal_dtor_for_ptr(zval *zvalue ZEND_FILE_LINE_DC)
ZEND_API void zval_add_ref(zval *p)
{
if (Z_REFCOUNTED_P(p)) {
- Z_ADDREF_P(p);
+//???: autoconversion from reverence to ordinal value
+ if (Z_ISREF_P(p) && Z_REFCOUNT_P(p) == 1) {
+ ZVAL_DUP(p, Z_REFVAL_P(p));
+ } else {
+ Z_ADDREF_P(p);
+ }
}
}
diff --git a/ext/standard/var.c b/ext/standard/var.c
index c84c651..2cd214d 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -97,7 +97,10 @@ PHPAPI void php_var_dump(zval *struc, int level TSRMLS_DC) /* {{{ */
}
if (Z_TYPE_P(struc) == IS_REFERENCE) {
- is_ref = 1;
+//??? hide references with refcount==1 (for compatibility)
+ if (Z_REFCOUNT_P(struc) > 1) {
+ is_ref = 1;
+ }
struc = Z_REFVAL_P(struc);
}
@@ -256,7 +259,10 @@ PHPAPI void php_debug_zval_dump(zval *struc, int level TSRMLS_DC) /* {{{ */
}
if (Z_TYPE_P(struc) == IS_REFERENCE) {
- is_ref = 1;
+//??? hide references with refcount==1 (for compatibility)
+ if (Z_REFCOUNT_P(struc) > 1) {
+ is_ref = 1;
+ }
struc = Z_REFVAL_P(struc);
}