<?php
declare(strict_types=1);require __DIR__.'/native.php';require $root.'/vendor/autoload.php';spl_autoload_register(static function($class)use($root){if(strpos($class,'app\\')===0){$f=$root.'/app/'.str_replace('\\','/',substr($class,4)).'.php';if(is_file($f))require $f;}},true,true);require __DIR__.'/NativePdo.php';$input=json_decode(file_get_contents(__DIR__.'/actual-cas-failure-plan.json'),true);CoreGate::$ids=['AI_U1'=>46916,'AI_U2'=>46917,'STORE_U1'=>99689,'STORE_U2'=>99690,'STORE_R1'=>78,'STORE_P1'=>23];CoreGate::$scenario='PREPAY_FIRST_RETRY';CoreGate::$generated=['ydy_meal_order'=>68496];CoreGate::$orderNo='261011086705426';CoreGate::$started=time();CoreGate::plan('ZHCT',$input['queryString'],$input['bind_plan']);$n=1;foreach([['id',24],['meal_order_id',9]] as [$key,$bad]){$b=$input['bind_plan'];$target=$key==='id'?'ThinkBind_5_1623941430_':'ThinkBind_6_1928975390_';$b[$target][0]=$bad;try{CoreGate::plan('ZHCT',$input['queryString'],$b);throw new LogicException('Bad CAS gate accepted');}catch(RuntimeException $e){$n++;}}try{CoreGate::plan('ZHCT',str_replace(' AND ',' OR ',$input['queryString']),$input['bind_plan']);throw new LogicException('OR accepted');}catch(RuntimeException $e){$n++;}echo json_encode(['original_SQL_bytes_preserved'=>true,'checks'=>$n,'counterexamples'=>3,'SQL'=>0,'HTTP'=>0]),"\n";
