I’ve spent a bit searching The Google as well as SO and have been unable to find an answer for this simple question:
What sort of issue would generate an E_COMPILE_WARNING in PHP?
The PHP manual entry on the subject docs says of E_COMPILE_WARNING:
Compile-time warnings (non-fatal errors). This is like an E_WARNING,
except it is generated by the Zend Scripting Engine.
But I’m not sure what this would constitute. What’s the difference between a regular E_WARNING and a warning raised by the Zend Scripting Engine? Could someone please explain and provide a code snippet if applicable?
Basically, the difference between an
E_WARNINGand anE_COMPILE_WARNINGis thatE_COMPILE_WARNINGis generated while the script is still compiling.E_COMPILE_WARNINGis similar toE_COMPILE_ERRORin that it is generated during compile time, but anE_COMPILE_WARNINGdoes not prevent script execution the wayE_COMPILE_ERRORdoes. Compare it to the the relation betweenE_ERRORandE_WARNING, where the former halts execution, and the latter allows execution to continue.For example, the following code generates an
E_COMPILE_WARNING:output:
Notice how the warning is displayed before the other output (even though “Hello World” came first in the source), and the
var_dumpstatement on line 5 references an error that occurs on line 6. PHP compiles the script, doesn’t likedeclare(foo='bar');, but goes back and executes the script anyway (as opposed to anE_COMPILE_ERRORlike$this = 2;, which would stop execution (and compilation) immediately).Hope this helps!