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

 ID:               61529
 Updated by:       php-bugs@lists.php.net
 Reported by:      asserte at gmail dot com
 Summary:          Make unset() an expression
-Status:           Feedback
+Status:           No Feedback
 Type:             Feature/Change Request
 Package:          Scripting Engine problem
 Operating System: Linux
 PHP Version:      5.4.1RC/5.5.0-dev

 New Comment:

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


Previous Comments:
------------------------------------------------------------------------
[2012-05-09 15:00:03] jelle dot zijlstra at gmail dot com

I just hit this bug trying to unset a variable in a for loop, like this:
<?php
for( ; ; unset($i)) {
    if($someCondition) {
        $i = 42;
    }
    if(isset($i)) {
        doSomething();
    } else {
        doSomethingElse();
    }
}

I understand why this currently fails and obviously there are workarounds, but 
intuitively unset should work in the third expression of a for loop.

------------------------------------------------------------------------
[2012-03-30 12:12:59] dmi...@php.net

I didn't test the patch just made a quick review. I suppose it's incomplete. 
With patch it's possible to write $a = unset($b), but UNSET opcode doesn't care 
about return value, so what's going to be assigned to $a?

In any case, I think, such changes are not allowed in minor releases. So must 
not be committed into 5.4. Personally, I don't think it makes sense for trunk 
as well. It always possible to write

if (isset($entity['id'])) unset($entity['id']);

More clear, and just a few characters more :)

------------------------------------------------------------------------
[2012-03-29 15:34:49] larue...@php.net

@nikic @reeze, after a deep thought,  I realize that I was wrong. yes, to fix 
this 
we should make unset return something.. 

so, mark it as a req , 
thanks

------------------------------------------------------------------------
[2012-03-29 14:59:36] larue...@php.net

@nikic thinking of isset, include. :)

------------------------------------------------------------------------
[2012-03-29 14:59:27] larue...@php.net

@nikic thinking of isset, include. :)

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


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=61529


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

Reply via email to