3v4l.org

run code in 500+ PHP versions simultaneously
<?php $cwd = sys_get_temp_dir() . '/php-src-proc-open-nul-poc'; @mkdir($cwd); try { $proc = proc_open([PHP_BINARY, '-r', "echo \0getcwd(), PHP_EOL;"], [1 => ['pipe', 'w']], $pipes, $cwd . "\0/ignored"); echo stream_get_contents($pipes[1]); proc_close($proc); } catch (ValueError $e) { echo $e->getMessage(), PHP_EOL; }
Output for 8.5.0 - 8.5.12
Command array element 3 contains a null byte
Output for 8.2.31 - 8.2.36, 8.3.0 - 8.3.37, 8.4.1 - 8.4.27
Fatal error: Uncaught Error: Call to undefined function proc_open() in /in/X0lWm:3 Stack trace: #0 {main} thrown in /in/X0lWm on line 3
Process exited with code 255.

preferences:
44.86 ms | 1167 KiB | 6 Q