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);
+ }
}
}
}
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);
}
}
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);
}