Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Missed method findRealpathInIncludePath() in Zend\Code\Reflection\FileReflection #4618

Closed

Conversation

weierophinney
Copy link
Member

Fatal error: Call to undefined method Zend\Code\Reflection\FileReflection::findRealpathInIncludePath() in /home/home/www/vendor/library/Zend/Code/Generator/FileGenerator.php on line 78

This occurs when data is non-existent file

$generator = new \Zend\Code\Generator\FileGenerator();
$file = $generator->fromReflectedFileName('/home/user/www/not_exists.php');

@weierophinney
Copy link
Member

So, to be clear, you feel that an error should be raised earlier if the file does not exist?

@Makar188
Copy link
Author

Yes

- method was not properly detecting when a file does not exist, in part
  due to using no longer implemented methods of FileReflection.
@ghost ghost assigned weierophinney Jun 11, 2013
@Maks3w
Copy link
Member

Maks3w commented Jun 12, 2013

Just for the record this patch use the same logic present in Zend\Code\Reflection\FileReflection constructor

$realpath = stream_resolve_include_path($filePath);
}

if (!$realpath || !in_array($realPath, get_included_files())) {
Copy link
Member

Choose a reason for hiding this comment

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

There is a typo in the second var $realpath !== $realPath. I'll fix this while merging.

Copy link
Member

Choose a reason for hiding this comment

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

Finally the check for included files can't be done here since $includeIfNotAlreadyIncluded parameter becomes unusable. I'm looking how to throubleshoot this situation.

@Maks3w
Copy link
Member

Maks3w commented Jun 12, 2013

Please review Maks3w@41310ce

Really the $includeIfNotAlreadyIncluded has a very low functionality since is if not set to true then a RuntimeException will be throwed.

@weierophinney
Copy link
Member

@Maks3w Makes sense -- I'll update shortly to include your commit.

@weierophinney
Copy link
Member

Actually, @Maks3w -- are you merging now? Don't want to mess things up for you...

@EvanDotPro
Copy link
Member

I reviewed Maks3w's 41310ce commit and ran into some broken tests -- he's fixing them now.

@Maks3w
Copy link
Member

Maks3w commented Jun 12, 2013

done

weierophinney added a commit that referenced this pull request Jun 12, 2013
- method was not properly detecting when a file does not exist, in part
  due to using no longer implemented methods of FileReflection.
Maks3w added a commit that referenced this pull request Jun 12, 2013
Maks3w added a commit that referenced this pull request Jun 12, 2013
…ause $includeIfNotAlreadyIncluded lost his functionality
Maks3w added a commit that referenced this pull request Jun 12, 2013
Maks3w added a commit that referenced this pull request Jun 12, 2013
weierophinney added a commit that referenced this pull request Jun 12, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants