note 92653 added to function.token-get-all
| From: | gomodo at free dot fr | Date: | Sun, 02 Aug 2009 17:08:03 +0000 |
| Subject: | note 92653 added to function.token-get-all | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159013@lists.php.net to get a copy of this message | ||
Yes, some problems (On WAMP, PHP 5.3.0 ) with get_token_all()
1 : bug line numbers
Since PHP 5.2.2 token_get_all() should return Line numbers in element 2..
.. but for instance (5.3.0 on WAMP), it work perfectly only with PHP code (not HMTL miwed), but if
you have some T_INLINE_HTML detected by token_get_all() , sometimes you find wrongs line numbers
(return next line)... :(
2: bug warning message can impact loops
Warning with php code uncompleted (ex : php code line by line) :
for example if a comment tag is not closed token_get_all() can block loops on this warning :
Warning: Unterminated comment starting line
This problem seem not occur in CLI mod (php command line), but only in web mod.
Waiting more stability, used token_get_all() only on PHP code (not HMTL miwed) :
First extract entirely PHP code (with open et close php tag),
Second use token_get_all() on the pure PHP code.
3 : Why there not function to extract PHP code (to extract HTML, we have Tidy..)?
Waiting, I used a function :
The code at end this post :
http://www.developpez.net/forums/d786381/php/langage/
fonctions/analyser-fichier-php-token_get_all/
This function not support :
- Old notation : "<? ?>" and "<% %>"
- heredoc syntax
- nowdoc syntax (since PHP 5.3.0)
----
Server IP: 89.31.146.176
Probable Submitter: 88.175.247.53
----
Manual Page -- http://www.php.net/manual/en/function.token-get-all.php
Edit -- https://master.php.net/note/edit/92653
Del: integrated -- https://master.php.net/note/delete/92653/integrated
Del: useless -- https://master.php.net/note/delete/92653/useless
Del: bad code -- https://master.php.net/note/delete/92653/bad+code
Del: spam -- https://master.php.net/note/delete/92653/spam
Del: non-english -- https://master.php.net/note/delete/92653/non-english
Del: in docs -- https://master.php.net/note/delete/92653/in+docs
Del: other reasons-- https://master.php.net/note/delete/92653
Reject -- https://master.php.net/note/reject/92653
Search -- https://master.php.net/manage/user-notes.php