fix: Strip shebang and <?php tag for PHP examples

The API runs PHP with -r flag which expects raw code without
opening tags. Strip #!/usr/bin/env php and <?php from PHP
files before sending to API.
This commit is contained in:
russell@unturf.com 2026-02-13 16:35:09 -05:00
parent a45f333b33
commit d0eca0cb7e

View file

@ -243,6 +243,11 @@ validate_example() {
return 1
fi
# Strip shebang and PHP opening tag for PHP files (API uses -r flag)
if [[ "$language" == "php" ]]; then
code=$(echo "$code" | sed '1{/^#!/d}' | sed '1{/^<?php/d}')
fi
# Measure execution time
start_time=$(date +%s%N)