Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Your code doesn't work...

The catch will never be called, and you should never use isset() because it will return false if the value exists but is null.

    whatever->param = null;
    whatever->param = 123;
Both lines will execute here.

    function __set($k, $v){
        if (array_key_exists($k, $this->Properties)){
            throw new ReadOnlyException();
        }else{
            $this->Properties[$k] = $v;
        }
    }


Yes, thank you. I noticed the problem after it was too late to edit. Slightly embarrassing.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: