note 88256 added to function.php-check-syntax

From: Date: Sat, 17 Jan 2009 14:43:00 +0000
Subject: note 88256 added to function.php-check-syntax
Groups: php.notes 
Request: Send a blank email to php-notes+get-149367@lists.php.net to get a copy of this message
Ugh, people.. Why you are doing these heavy and weird stuff? <?php function is_php_ok($body) { ob_start(); $eval = eval('?><? if(0){?>'. $body.'?><? }?>'); $output = ob_get_contents(); ob_end_clean(); $eval===false ? $GLOBALS['phpERROR'] = str_replace('<b>Parse error</b>: parse error,','Parse error:',str_replace('<!--error--><br />','',substr($output,0,strpos($output,' in ')))).' '.substr($output,strpos($output,'on line')-5):''; return $eval===false?false:true; } $body = '<? checkme()?>sdfgsdgsf<?=fdf\'()?>bla blvv'; if (!is_php_ok($body)) { echo 'Whoops, errors were made: '.$GLOBALS['phpERROR']; } ?> Enjoy;) Simple and useful. ---- Server IP: 195.222.16.155 Probable Submitter: ::ffff:82.147.167.254 ---- Manual Page -- http://www.php.net/manual/en/function.php-check-syntax.php Edit -- https://master.php.net/note/edit/88256 Del: integrated -- https://master.php.net/note/delete/88256/integrated Del: useless -- https://master.php.net/note/delete/88256/useless Del: bad code -- https://master.php.net/note/delete/88256/bad+code Del: spam -- https://master.php.net/note/delete/88256/spam Del: non-english -- https://master.php.net/note/delete/88256/non-english Del: in docs -- https://master.php.net/note/delete/88256/in+docs Del: other reasons-- https://master.php.net/note/delete/88256 Reject -- https://master.php.net/note/reject/88256 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#149367) next »