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
bug A bug report status: low Low

Comments

@TimurFlush
Copy link

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
Copy link

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

@TimurFlush
Copy link
Author

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 4.0 and removed 4.1 labels Jun 21, 2019
@CameronHall
Copy link
Contributor

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

@niden niden added bug A bug report status: low Low and removed Bug - Low labels Dec 23, 2019
@niden niden added 4.0.1 and removed 4.1.0 labels Dec 25, 2019
@niden niden added 4.1.0 and removed 4.0.1 labels Dec 25, 2019
@niden
Copy link
Member

niden commented Dec 25, 2019

Resolved in #14659

@niden niden closed this as completed Dec 25, 2019
@niden niden added 4.0.1 and removed 4.1.0 labels Dec 25, 2019
@niden niden moved this to Released in Phalcon v5 Aug 25, 2022
@niden niden added this to Phalcon v5 Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: low Low
Projects
Archived in project
Development

No branches or pull requests

4 participants