bug38779.phpt 797 B

1234567891011121314151617181920212223242526272829303132
  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. }
  25. stream_wrapper_register('Loader', 'Loader');
  26. require 'Loader://qqq.php';
  27. echo "Done\n";
  28. ?>
  29. --EXPECTF--
  30. Parse error: %s error%sin Loader://qqq.php on line %d