010.phpt 947 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --TEST--
  2. Bug #45860 (header() function fails to correctly replace all Status lines)
  3. --SKIPIF--
  4. <?php include "skipif.inc"; ?>
  5. --FILE--
  6. <?php
  7. include "include.inc";
  8. $php = get_cgi_path();
  9. reset_env_vars();
  10. $f = tempnam(sys_get_temp_dir(), 'cgitest');
  11. putenv("TRANSLATED_PATH=".$f."/x");
  12. putenv("SCRIPT_FILENAME=".$f."/x");
  13. file_put_contents($f, '<?php
  14. header("HTTP/1.1 403 Forbidden");
  15. header("Status: 403 Also Forbidden");
  16. ?>');
  17. echo (`$php -n $f`);
  18. file_put_contents($f, '<?php
  19. header("HTTP/1.1 403 Forbidden");
  20. ?>');
  21. echo (`$php -n $f`);
  22. file_put_contents($f, '<?php
  23. header("Status: 403 Also Forbidden");
  24. ?>');
  25. echo (`$php -n $f`);
  26. echo "Done\n";
  27. @unlink($f);
  28. ?>
  29. --EXPECTF--
  30. Status: 403 Forbidden
  31. X-Powered-By: PHP/%s
  32. Content-type: text/html; charset=UTF-8
  33. Status: 403 Forbidden
  34. X-Powered-By: PHP/%s
  35. Content-type: text/html; charset=UTF-8
  36. X-Powered-By: PHP/%s
  37. Status: 403 Also Forbidden
  38. Content-type: text/html; charset=UTF-8
  39. Done