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

ext/reflection #1083

Closed
wants to merge 8 commits into from
Closed

ext/reflection #1083

wants to merge 8 commits into from

Conversation

simonwelsh
Copy link
Contributor

Work in progress, do not merge

This is my progress so far of getting ext/reflection reaching parity with Zend.

The main change I'm currently looking for review on is the addition of the invoke_ancestor_method function in 070875b.

@simonwelsh
Copy link
Contributor Author

I'll tidy the commits up once it's ready for merging.

@scannell
Copy link
Contributor

Thanks for working on this! Just let us know when it's in shape and I'll take a look.

@simonwelsh
Copy link
Contributor Author

55 commits was starting to look messy, so I rebased and squashed most of them. I'm about of a third of the way through the Zend ext/reflection tests. There's some that fail because of expected format for a var_dump or reliance on the way properties are returned internally, so I'll be copying those into tests outside of the zend folder.

b56e6ab has been cherry-picked into #1127

@simonwelsh
Copy link
Contributor Author

There's also tests that rely on the standard extension, and the information that you can usually get out of that. I'm unsure as to where to implement that, since it doesn't look like there's any one place that defines a "standard" extension to add in the moduleInfo method.

@scannell
Copy link
Contributor

scannell commented Oct 4, 2013

Those look like real failing tests...

@scannell
Copy link
Contributor

scannell commented Oct 4, 2013

And in general, it would be better to split this up into multiple pulls since Github isn't very good at cherry picking from these (and even if you do it's hard to track what was done) -- we shy away from monolithic commits because it is much easier to revert clean and small ones quickly when something breaks and easier to bisect.

@simonwelsh
Copy link
Contributor Author

Looking at the failing tests, and I'm not entirely sure what to do about them.

The first one's from what appears to be a lazy evaluation of string concatenation with echo (echo METHOD . "($arg)\n"; with $arg undefined is echoing everything up to the ( then throwing the notice)

The second one's expected: can't change accessibility of private members in repo authoritative mode.

The third one looks like f_hphp_set_static_property doesn't work consistently in repo authoritative mode. I'll need to look into that.

@scannell
Copy link
Contributor

scannell commented Oct 7, 2013

For tests for functionality that won't work in repo mode, you can (and should) add an empty .php.norepo file of the same name to skip it in repo mode.

@scannell
Copy link
Contributor

scannell commented Oct 7, 2013

For the first one, feel free to just not move that test over too.

@simonwelsh
Copy link
Contributor Author

I was thinking that it'd make sense to not allow the mutating reflection methods to work in repo authoritative mode, given that it looks like there's some optimisations done that don't play nice with it. It might just be that these optimisations only effect static variables, in which case it'll make sense to only disallow mutating those.

@scannell
Copy link
Contributor

scannell commented Oct 8, 2013

I think that is a reasonable restriction; even if you did allow them, if it changes properties of functions that we made assumptions about, something is going to break. (Certainly with RepoAuthoritative and WholeProgram optimizations enabled something is likely to break here.)

@scannell
Copy link
Contributor

scannell commented Dec 2, 2013

I'm going to close for now since this has been idle for months. @simonwelsh, if you want to continue with this, feel free to reopen it when it is ready or create a new PR.

@scannell scannell closed this Dec 2, 2013
@Majkl578
Copy link
Contributor

Any progress with reflection? It's currently blocking usage of nette/nette.

@scannell
Copy link
Contributor

I can't speak for @simonwelsh on this pull request but some fixes to reflection were made in trunk over the lockdown so it's possible things have improved for you.

@Majkl578
Copy link
Contributor

Ok, compiling master right now, I will try again and let you know.

if($this->info['name'] == '__construct') {
return true;
} else {
return strcasecmp($this->info['class'], $this->_class) == 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this include a check for the class being in the global namespace ?

@simonwelsh simonwelsh deleted the reflect branch May 20, 2014 05:09
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