isset / unset should silently fail #12

Closed
cpriest opened this Issue Dec 29, 2012 · 4 comments

Comments

Projects
None yet
2 participants
Owner

cpriest commented Dec 29, 2012

Invalid calls to isset/unset will fail silently and return false in the case of isset(), no warning/notice should be thrown.

Owner

cpriest commented Dec 29, 2012

Invalid calls to isset/unset will fail silently and return false in the case of isset(), no warning/notice should be thrown.

class TimePeriod {
    private $Seconds;

    protected $Seconds {
        get() { return $this->Seconds; /* Accesses the private $Seconds directly */ }
        set($x) { $this->Seconds = $x; /* Accesses the private $Seconds directly */ }
    }
}

$o = new TimePeriod();
isset($o->Seconds); /* Returns false, no error thrown */
unset($o->Seconds);  /* Does nothing, no error thrown */

@cpriest cpriest closed this Jan 4, 2013

@cpriest cpriest reopened this Jan 4, 2013

Owner

cpriest commented Jan 10, 2013

This has really already been written in, however it is not quite as the title indicates. I went back and read over the initial discussion of this topic on internals and no mention that unset should behave this way (silently). So the final situation is that isset() silently fails and returns false while unset emits a warning and has no effect, but execution continues.

@cpriest cpriest closed this Jan 10, 2013

Collaborator

nikic commented Jan 10, 2013

@cpriest Sounds good to me. Could you update the RFC regarding that change?

Owner

cpriest commented Jan 11, 2013

Already have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment