@@ -44,15 +44,10 @@ protected function doClone($var)
4444 $ a = null ; // Array cast for nested structures
4545 $ stub = null ; // Stub capturing the main properties of an original item value
4646 // or null if the original value is used directly
47- $ zval = array ( // Main properties of the current value
48- 'type ' => null ,
49- 'zval_isref ' => null ,
50- 'zval_hash ' => null ,
51- 'array_count ' => null ,
52- 'object_class ' => null ,
53- 'object_handle ' => null ,
54- 'resource_type ' => null ,
55- );
47+ $ zvalType = null ; // Main properties of the current value
48+ $ zvalIsRef = null ;
49+ $ zvalHash = null ;
50+
5651 if (!self ::$ hashMask ) {
5752 self ::initHashMask ();
5853 }
@@ -84,14 +79,14 @@ protected function doClone($var)
8479 $ k = $ j ;
8580 }
8681 $ refs [$ k ] = $ cookie ;
87- if ($ zval [ ' zval_isref ' ] = $ vals [$ k ] === $ cookie ) {
88- $ zval [ ' zval_hash ' ] = $ v instanceof Stub ? spl_object_hash ($ v ) : null ;
82+ if ($ zvalIsRef = $ vals [$ k ] === $ cookie ) {
83+ $ zvalHash = $ v instanceof Stub ? spl_object_hash ($ v ) : null ;
8984 }
90- $ zval [ ' type ' ] = gettype ($ v );
91- if ($ zval [ ' zval_isref ' ] ) {
85+ $ zvalType = gettype ($ v );
86+ if ($ zvalIsRef ) {
9287 $ vals [$ k ] = &$ stub ; // Break hard references to make $queue completely
9388 unset($ stub ); // independent from the original structure
94- if (isset ($ hardRefs [$ zval [ ' zval_hash ' ] ])) {
89+ if (isset ($ hardRefs [$ zvalHash ])) {
9590 $ vals [$ k ] = $ refs [$ k ] = $ v ;
9691 if ($ v ->value instanceof Stub && (Stub::TYPE_OBJECT === $ v ->value ->type || Stub::TYPE_RESOURCE === $ v ->value ->type )) {
9792 ++$ v ->value ->refCount ;
@@ -102,7 +97,7 @@ protected function doClone($var)
10297 }
10398 // Create $stub when the original value $v can not be used directly
10499 // If $v is a nested structure, put that structure in array $a
105- switch ($ zval [ ' type ' ] ) {
100+ switch ($ zvalType ) {
106101 case 'string ' :
107102 if (isset ($ v [0 ]) && !preg_match ('//u ' , $ v )) {
108103 $ stub = new Stub ();
@@ -148,15 +143,15 @@ protected function doClone($var)
148143 $ a = $ v ;
149144 }
150145
151- $ stub ->value = $ zval [ ' array_count ' ] ?: count ($ a );
146+ $ stub ->value = count ($ a );
152147 }
153148 break ;
154149
155150 case 'object ' :
156- if (empty ($ objRefs [$ h = $ zval [ ' object_handle ' ] ?: ( $ hashMask ^ hexdec (substr (spl_object_hash ($ v ), $ hashOffset , PHP_INT_SIZE ) ))])) {
151+ if (empty ($ objRefs [$ h = $ hashMask ^ hexdec (substr (spl_object_hash ($ v ), $ hashOffset , PHP_INT_SIZE ))])) {
157152 $ stub = new Stub ();
158153 $ stub ->type = Stub::TYPE_OBJECT ;
159- $ stub ->class = $ zval [ ' object_class ' ] ?: get_class ($ v );
154+ $ stub ->class = get_class ($ v );
160155 $ stub ->value = $ v ;
161156 $ stub ->handle = $ h ;
162157 $ a = $ this ->castObject ($ stub , 0 < $ i );
@@ -188,7 +183,7 @@ protected function doClone($var)
188183 if (empty ($ resRefs [$ h = (int ) $ v ])) {
189184 $ stub = new Stub ();
190185 $ stub ->type = Stub::TYPE_RESOURCE ;
191- if ('Unknown ' === $ stub ->class = $ zval [ ' resource_type ' ] ?: @get_resource_type ($ v )) {
186+ if ('Unknown ' === $ stub ->class = @get_resource_type ($ v )) {
192187 $ stub ->class = 'Closed ' ;
193188 }
194189 $ stub ->value = $ v ;
@@ -211,7 +206,7 @@ protected function doClone($var)
211206 }
212207
213208 if (isset ($ stub )) {
214- if ($ zval [ ' zval_isref ' ] ) {
209+ if ($ zvalIsRef ) {
215210 $ refs [$ k ] = new Stub ();
216211 $ refs [$ k ]->value = $ stub ;
217212 $ h = spl_object_hash ($ refs [$ k ]);
@@ -245,7 +240,7 @@ protected function doClone($var)
245240 $ stub ->position = $ len ++;
246241 }
247242 $ stub = $ a = null ;
248- } elseif ($ zval [ ' zval_isref ' ] ) {
243+ } elseif ($ zvalIsRef ) {
249244 $ refs [$ k ] = $ vals [$ k ] = new Stub ();
250245 $ refs [$ k ]->value = $ v ;
251246 $ h = spl_object_hash ($ refs [$ k ]);
0 commit comments