Bug #46689

The new ClassLoader swallows Fatal Errors

Added by Marc Neuhaus over 2 years ago. Updated about 2 years ago.

Status:New Start date:2013-03-26
Priority:Must have Due date:
Assigned To:Marc Neuhaus % Done:

0%

Category:-
Target version:-
PHP Version: Complexity:
Has patch:No Affected Flow version:Git master

Description

Since the new ClassLoader uses '@include' to load classes E_COMPILE_ERROR errors are completely
ignored. The aren't shown (display_errors), logged to the php log (log_errors) or logged
anywhere through Flow. The main issue seems, that the combination of the @ error control character
and set_error_handler let those E_COMPILE_ERROR slip through.

The only way around this was to register a shutdown function to catch those errors.

Associated revisions

Revision f04343e1
Added by Robert Lemke over 2 years ago

[TASK] Remove @-operator again in SimpleFileBackend and ClassLoader

This change removes the shut-up operator again from include_once()
calls in the ClassLoader and SimpleFileBackend in order to provide
meaningful error messages to the developer if class files or cache
entries were not found.

Change-Id: I45a338cca7bd221ba88eeb4eb699796a2447b16c
Related: #46689
Releases: 2.0, master

Revision 8d4f25bd
Added by Robert Lemke over 2 years ago

[TASK] Remove @-operator again in SimpleFileBackend and ClassLoader

This change removes the shut-up operator again from include_once()
calls in the ClassLoader and SimpleFileBackend in order to provide
meaningful error messages to the developer if class files or cache
entries were not found.

Change-Id: I45a338cca7bd221ba88eeb4eb699796a2447b16c
Related: #46689
Releases: 2.0, master

History

#1 Updated by Andreas Wolf over 2 years ago

I also get this error here, more precisely during the compile step. The error message displayed is "Execution of subprocess failed with exit code 255 without any further output. (Please check your PHP error log for possible Fatal errors)". There is no log entry whatsoever, the exception log is also not helpful.

@Marc: What does your shutdown function do? Can it detect the compilation error (and maybe also the possible reason?)

#2 Updated by Adrian Föder over 2 years ago

just fell prey to this in this exact minute; we urgently need a fix here... Was seeking for half an hour for the reason until I realized that there just was some file not found...

#3 Updated by Bastian Waidelich over 2 years ago

Adrian Föder wrote:

just fell prey to this in this exact minute; we urgently need a fix here... Was seeking for half an hour for the reason until I realized that there just was some file not found...

+1

#4 Updated by Marc Neuhaus over 2 years ago

#5 Updated by Adrian Föder over 2 years ago

I began to dig a bit, and most errors come from the annotation corner anyways, that is, for example, occurrences of @todo, @version, @static etc., all resulting in trying to fetch such a class.

Also the "Annotation" class which is tried to be called because of "@Annotation" occurrences should not result into loading them, doctrine already cares about:

https://github.com/doctrine/annotations/blob/master/lib/Doctrine/Common/Annotations/DocParser.php#L443 (special treatment of @Annotation

and

https://github.com/doctrine/annotations/blob/master/lib/Doctrine/Common/Annotations/AnnotationReader.php#L56-L73 (ignoring @static, @todo etc. annotations)

We should check why this doesn't work, prior to ignore some errors which should actually not be ignored.

#6 Updated by Adrian Föder over 2 years ago

ok, that's simple, however not nice, see

https://github.com/doctrine/annotations/blob/master/lib/Doctrine/Common/Annotations/DocParser.php#L626

and a few lines below, 631.

The Parser triggers Flow's class loader with everything, including the unwanted classes, and we're already running into that trouble then.
Having said this, I'm sure you guys already knew that ;)

#7 Updated by Frans Saris about 2 years ago

Since this change was merged we get the folowing PHP Warnings:

PHP Warning:  include_once(...../Data/Temporary/Development/Cache/Code/Flow_Object_Classes/TYPO3_Flow_Session_SessionManagerInterface.php): failed to open stream: No such file or directory in ..../Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Cache/Backend/SimpleFileBackend.php on line 272

PHP Warning:  include_once(): Failed opening '..../Data/Temporary/Development/Cache/Code/Flow_Object_Classes/TYPO3_Flow_Session_SessionManagerInterface.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in ..../Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Cache/Backend/SimpleFileBackend.php on line 272

PHP Warning:  include_once(): Failed opening '..../Data/Temporary/Development/Cache/Code/Flow_Object_Classes/TYPO3_Flow_Session_SessionInterface.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in ..../Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Cache/Backend/SimpleFileBackend.php on line 272
etc.

Is this normal behavior because the cache file isn't there yet or is there something wrong with the annotations as stated above?

This is from a script that runs through cli.

Also available in: Atom PDF