note 115099 added to function.halt-compiler

From: Date: Sun, 25 May 2014 16:10:53 +0000
Subject: note 115099 added to function.halt-compiler
Groups: php.notes 
Request: Send a blank email to php-notes+get-199619@lists.php.net to get a copy of this message
I don't exactly know what PHP is doing internally but I don't understand the sanity behind how in token_get_all __halt_compiler is handled. This is actually valid there: __halt_compiler/**/ /**/ /**/ /**/ /** */();raw Normally it pops off just any three tokens so you can have even __halt_compiler***, __halt_compiler))), etc in token _get all. The weird thing is that is also skips T_OPEN_TAG but in the context __halt_compiler runs in this tag should not be posible. Instead it will pick up < and ? as operators and php as a T_STRING. It ignores the token at any point so this is also valid: __halt_compiler()/**/ /**/ /**/ /**/ /** */;raw When I test this with a php file rather than the tokeniser it works the same. I can only conclude that PHP/__halt_compiler is pretty weird. I think this is from attempting to weakly imitate the same syntax handling as in functions (I guess you can put comments/whitespace anywhere). I find it annoying and counter productive though. Even this is valid: __halt_compiler// comment\n();raw A general problem that compound matters is that tokenise wont check whether or not syntax is valid (tokens against each other). When running as PHP you must have ();. ---- Server IP: 72.52.91.14 Probable Submitter: 149.6.187.130 ---- Manual Page -- http://php.net/manual/en/function.halt-compiler.php Edit -- https://master.php.net/note/edit/115099 Del: integrated -- https://master.php.net/note/delete/115099/integrated Del: useless -- https://master.php.net/note/delete/115099/useless Del: bad code -- https://master.php.net/note/delete/115099/bad+code Del: spam -- https://master.php.net/note/delete/115099/spam Del: non-english -- https://master.php.net/note/delete/115099/non-english Del: in docs -- https://master.php.net/note/delete/115099/in+docs Del: other reasons-- https://master.php.net/note/delete/115099 Reject -- https://master.php.net/note/reject/115099 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#199619) next »