run code in 200+ php & hhvm versions
Bugs & Features
<?php $msg=$_GET['msg']??"no msg!"; file_put_contents('msg.log.txt',$msg."\r\n",FILE_APPEND|LOCK_EX); $matches=NULL; $isMatch=preg_match("/\d+\s*(?:\+|\-|\*|\/|\:)\s*\d+/",$msg,$matches); if($isMatch){ $matches[0]=strtr($matches[0],array(':'=>'/')); //var_dump($matches) & die(); $res=eval("return (".$matches[0].");"); // var_dump($res); echo "!check {$res}"; }
Output for 7.1.25 - 7.3.1
Warning: file_put_contents(): open_basedir restriction in effect. File(msg.log.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/BvG1l on line 3 Warning: file_put_contents(msg.log.txt): failed to open stream: Operation not permitted in /in/BvG1l on line 3