Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Result of empty construction on model properties #13900

Closed
TimurFlush opened this issue Mar 15, 2019 · 4 comments
Closed

[Bug] Result of empty construction on model properties #13900

TimurFlush opened this issue Mar 15, 2019 · 4 comments
Assignees
Labels

Comments

@TimurFlush
Copy link

@TimurFlush TimurFlush commented Mar 15, 2019

Hello.

Actual for 3.4.2, and possibly for 4.0 branch.

Please see:

class SomeModel extends \Phalcon\Mvc\Model 
{
    # It's a protected property.
    protected $someProperty;

    # It are getters.
    public function setSomeProperty(){}
    public function getSomeProperty(){ return 'someValue'; }
}

/** @var SomeModel $model **/

var_dump(empty($model->someProperty)); //true (Actual behavior)
var_dump(empty($model->getSomeProperty())); //false (Need behavior)
@ViltusVilks

This comment has been minimized.

Copy link

@ViltusVilks ViltusVilks commented Mar 16, 2019

getSomeProperty() { return 'someValue'; } returns non-empty result.
Or this is just a typo in the example code?

@TimurFlush

This comment has been minimized.

Copy link
Author

@TimurFlush TimurFlush commented Mar 16, 2019

@ViltusVilks
getSomeProperty() is a getter for someProperty, because someProperty is protected property. In this case, empty construction must be return false, but returns true on the protected property.

@niden niden added the Bug - Low label May 16, 2019
@niden niden added this to To do in 4.1 Release via automation May 16, 2019
@niden niden added 4.0 4.1.0 and removed 4.1.0 4.0 labels Jun 21, 2019
@CameronHall

This comment has been minimized.

Copy link
Member

@CameronHall CameronHall commented Jun 23, 2019

This is because empty will call __isset (if defined) on inaccessible properties. Related to #13518.

@niden niden added bug status: low and removed Bug - Low labels Dec 23, 2019
@ruudboon ruudboon added this to Backlog in Phalcon Roadmap Dec 24, 2019
@niden niden removed this from To do in 4.1 Release Dec 24, 2019
@niden niden added 4.0.1 and removed 4.1.0 labels Dec 25, 2019
@niden niden moved this from Backlog to Current Sprint (Ends January 10th) in Phalcon Roadmap Dec 25, 2019
@niden niden moved this from Current Sprint (Ends January 10th) to Working on it in Phalcon Roadmap Dec 25, 2019
@niden niden added 4.1.0 and removed 4.0.1 labels Dec 25, 2019
@niden niden mentioned this issue Dec 25, 2019
4 of 5 tasks complete
@niden

This comment has been minimized.

Copy link
Member

@niden niden commented Dec 25, 2019

Resolved in #14659

@niden niden closed this Dec 25, 2019
@niden niden moved this from Working on it to Implemented in Phalcon Roadmap Dec 25, 2019
@niden niden added 4.0.1 and removed 4.1.0 labels Dec 25, 2019
@niden niden moved this from Implemented to Released in Phalcon Roadmap Jan 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Phalcon Roadmap
  
Released
4 participants
You can’t perform that action at this time.