Avoid a critical error when parsed class is not found #197

Merged
merged 3 commits into from Oct 7, 2012

4 participants

@alphalemon

Found a bug that returns a critical error when parsed class is not found. The new test explains exactly the situation found.

This issue was found running this test suite: https://github.com/alphalemon/AlphaLemonCmsBundle, running the following test; phpunit Tests/Functional/Controller/SecuryControllerTest.php

@doctrinebot

Hello,

thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

http://doctrine-project.org/jira/browse/DCOM-120

@stof stof commented on an outdated diff Oct 3, 2012
lib/Doctrine/Common/Annotations/PhpParser.php
@@ -64,6 +68,8 @@ public function parseClass(\ReflectionClass $class)
*/
private function getFileContent($filename, $lineNumber)
{
+ if (!file_exists($filename)) return null;
@stof
Doctrine member
stof added a note Oct 3, 2012

Please fix the coding standards. You should always use curly braces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@alphalemon

Ok, did it! :)

@guilhermeblanco guilhermeblanco commented on the diff Oct 3, 2012
lib/Doctrine/Common/Annotations/PhpParser.php
@@ -46,6 +46,10 @@ public function parseClass(\ReflectionClass $class)
}
$content = $this->getFileContent($filename, $class->getStartLine());
@guilhermeblanco
Doctrine member

Missing line break

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@guilhermeblanco guilhermeblanco commented on an outdated diff Oct 3, 2012
lib/Doctrine/Common/Annotations/PhpParser.php
@@ -64,6 +68,10 @@ public function parseClass(\ReflectionClass $class)
*/
private function getFileContent($filename, $lineNumber)
{
+ if (!file_exists($filename)) {
@guilhermeblanco
Doctrine member

Missing spaces around !.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@alphalemon

Hi,
is now good to merge?

@schmittjoh schmittjoh merged commit 150cb23 into doctrine:master Oct 7, 2012

1 check passed

Details default The Travis build passed
@schmittjoh
Doctrine member

Yes, thanks :)

@alphalemon

Thank you guys! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment