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

Unset public properties also cause calls to __unset() #1930

Conversation

Ocramius
Copy link
Contributor

__unset() was being called only for private and protected properties, as it seems.


class Foo {
private $private;
private $protected;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: shoud be protected

@scannell
Copy link
Contributor

Hi @Ocramius -- we don't add failing tests. Are you planning on updating this to fix it? Otherwise I'll close this; it should be opened as an issue with the sample code.

@Ocramius
Copy link
Contributor Author

@scannell the PR is in place to allow merging it into a patch if somebody wants to pick it up. I will give it a shot, but I'm most probably not going to be able to fix this.

If I had opened an issue, it would have still been an issue referencing a branch in a link - same as doing a PR, except that we get a nice diff view as well as reviews here :P

@scannell
Copy link
Contributor

Cool. In the meantime I'm going to close this since there's no follow-up action -- someone else can merge it into theirs if they decide to fix it.

@scannell scannell closed this Feb 27, 2014
@ptarjan ptarjan reopened this Feb 28, 2014
@ptarjan
Copy link
Contributor

ptarjan commented Feb 28, 2014

@Ocramius has a fix

@scannell
Copy link
Contributor

(CC @fredemmott)

@@ -0,0 +1,17 @@
<?php
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if these should be in slow or fast

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, everything should be in slow. The only things that go in quick are hand selected to be a litmus test that the compiler sort of works.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but please don't just put it in the root of slow. Put it in a subdir that makes sense.

@ptarjan
Copy link
Contributor

ptarjan commented Mar 7, 2014

Is this diff waiting on something?

@Ocramius
Copy link
Contributor Author

Ocramius commented Mar 7, 2014

@ptarjan except for householding (moving tests to /slow) I don't know what to do about:

These are mainly string mismatches in fatals due to how the access to an invalid property is handled.
The destructor test I didn't notice before

@ptarjan
Copy link
Contributor

ptarjan commented Mar 7, 2014

@Ocramius The first 2 look completely reasonable to change the error string (what does zend output? Are we close?) The last one seems bad since it is an existing Zend test. Are you doing something wrong? Should that warning not happen in a destructor? Are you trying to do this change to be more similar to zend, and if so, why didn't they print that error?

@Ocramius
Copy link
Contributor Author

Ocramius commented Mar 7, 2014

@ptarjan for the destructor one (test) it looks plain wrong - there is a scope violation, and I don't understand how it is supposed to work in Zend, but my first assumption is that the fatal is swallowed during engine teardown, while HHVM still produces output (just a speculation).

In this (test) and this (test), the difference seems to lie in the fact that I deny unset before the actual property access is attempted (access to properties starting with \0 is denied in Zend): the functional result is the same, the fatal is different.

@ptarjan
Copy link
Contributor

ptarjan commented Mar 8, 2014

@Ocramius if it is just error string mismatches, then just update them. The destructor is the only one I really care about. Maybe you can dig into why we still produce error and they don't? Do they set a flag that they are tearing down and don't show errors? Can you reproduce it via other means? I need you to dig more before we move the test to bad.

@Ocramius
Copy link
Contributor Author

Ocramius commented Mar 9, 2014

After looking some more into it, I found out that I totally misread this test case.

The fix should now be mergeable, sorry about all the fuss. (failures in travis are not related)

@ptarjan
Copy link
Contributor

ptarjan commented Mar 10, 2014

D1211230

@sgolemon sgolemon closed this in 96f2cad Mar 12, 2014
@Ocramius Ocramius deleted the bug/public-property-unsetting-__unset-triggering branch March 12, 2014 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants