bug38779.phpt 958 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. Bug #38779 (engine crashes when require()'ing file with syntax error through userspace stream wrapper)
  3. --FILE--
  4. <?php
  5. class Loader {
  6. private $position;
  7. private $data;
  8. public function stream_open($path, $mode, $options, &$opened_path) {
  9. $this->data = '<' . "?php \n\"\";ll l\n ?" . '>';
  10. $this->position = 0;
  11. return true;
  12. }
  13. function stream_read($count) {
  14. $ret = substr($this->data, $this->position, $count);
  15. $this->position += strlen($ret);
  16. return $ret;
  17. }
  18. function stream_eof() {
  19. return $this->position >= strlen($this->data);
  20. }
  21. function stream_stat() {
  22. return array('size' => strlen($this->data));
  23. }
  24. function stream_set_option($option, $arg1, $arg2) {
  25. return false;
  26. }
  27. }
  28. stream_wrapper_register('Loader', 'Loader');
  29. require 'Loader://qqq.php';
  30. echo "Done\n";
  31. ?>
  32. --EXPECTF--
  33. Parse error: %s error%sin Loader://qqq.php on line %d