3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ApiController { /* * * Public methods meant to be exposed... * */ protected function protectedMethod() { echo "This should be protected!"; } public function handle($method) { if (!is_callable(array($this, $method))) { die("Not callable!"); } $refMethod = new ReflectionMethod($this, $method); $refMethod->invoke($this); // No visibility check } } // Simulate a web request $api = new ApiController(); $api->handle('protectedMethod');

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
152.59 ms | 3464 KiB | 9 Q