Bug #72543 [Asn]: different references behavior comparing to 5.5

From: Date: Tue, 05 Jul 2016 11:19:59 +0000
Subject: Bug #72543 [Asn]: different references behavior comparing to 5.5
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202062@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72543&edit=1

 ID:                 72543
 Updated by:         laruence@php.net
 Reported by:        tony2001@php.net
 Summary:            different references behavior comparing to 5.5
 Status:             Assigned
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   *
 PHP Version:        7.1.0alpha1
 Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

does your patch also take care of

$arr = 'b';
$$arr['b']['b'] = $b['b']; ?


Previous Comments:
------------------------------------------------------------------------
[2016-07-05 10:45:34] dmitry@php.net

The following patch has been added/updated:

Patch Name: bug72543.diff
Revision:   1467715534
URL:        https://bugs.php.net/patch-display.php?bug=72543&patch=bug72543.diff&revision=1467715534

------------------------------------------------------------------------
[2016-07-05 09:58:48] dmitry@php.net

Before execution of the following statement $copy['b'] is a "dead" REFERENCE
with refcount==1. 

$copy['b']['b'] = $copy['b'];

Right-side expression evaluated first, and incrementats REFERENCE refcount (it became 2). After
that, it starts to behave as a real REFERENCE and is not separated during left-side expression
evaluation.

------------------------------------------------------------------------
[2016-07-05 03:17:14] laruence@php.net

yeah, I agree with that, but if cheaper fix is mess, than I prefer a clear one, besides, one
UNEXPECT check should not change anything in performance.

------------------------------------------------------------------------
[2016-07-04 17:02:10] dmitry@php.net

In general, you fix is right, but it introduces an extra check on fast path, that is useless in
almost all cases. I'll try to find a cheaper solution.

------------------------------------------------------------------------
[2016-07-04 15:52:37] laruence@php.net

@Dmitry, this reminds me of the patch I committed before(it was replaced though), http://pastebin.com/jHGEL7v8 the base idea here is, we
should return non-reference in read context(FETCH_DIM_R), that patch should fix this problem as well

what do you think?

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=72543


--
Edit this bug report at https://bugs.php.net/bug.php?id=72543&edit=1


Thread (12 messages)

« previous php.bugs (#202062) next »