Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HHVM fails silently if required file does not have read permissions #4656

Closed
kristapsk opened this issue Jan 16, 2015 · 4 comments
Closed

HHVM fails silently if required file does not have read permissions #4656

kristapsk opened this issue Jan 16, 2015 · 4 comments

Comments

@kristapsk
Copy link
Contributor

<?php
file_put_contents('testi.php', "<?php\necho 'blah';\n");
chmod('testi.php', 0000);
require_once 'testi.php';

PHP output:

PHP Warning:  require_once(/home/neonz/testi.php): failed to open stream: Permission denied in /home/neonz/testr.php on line 4

Warning: require_once(/home/neonz/testi.php): failed to open stream: Permission denied in /home/neonz/testr.php on line 4
PHP Fatal error:  require_once(): Failed opening required 'testi.php' (include_path='.:/usr/share/php5:/usr/share/php') in /home/neonz/testr.php on line 4

Fatal error: require_once(): Failed opening required 'testi.php' (include_path='.:/usr/share/php5:/usr/share/php') in /home/neonz/testr.php on line 4

HHVM does not output anything.

@Majkl578
Copy link
Contributor

It outputs something: http://3v4l.org/nebVh

@paulbiss
Copy link
Contributor

@Majkl578 that's because the directory isn't writable (notice the preceding warning for line 3). If the file does exist and is inaccessible then we appear to silently fail on master.

@jesseschalken
Copy link
Contributor

On HHVM 3.19.1 the test script produces


Fatal error: require_once(testi.php): File not found in /home/ubuntu/test.php on line 6

while PHP 7.0.15 produces

PHP Warning:  require_once(/home/ubuntu/testi.php): failed to open stream: Permission denied in /home/ubuntu/test.php on line 6
PHP Stack trace:
PHP   1. {main}() /home/ubuntu/test.php:0
PHP Fatal error:  require_once(): Failed opening required 'testi.php' (include_path='.:/usr/share/php') in /home/ubuntu/test.php on line 6
PHP Stack trace:
PHP   1. {main}() /home/ubuntu/test.php:0

I'm not sure why PHP issues both a warning and a fatal, but HHVM is at least not silent.

@lexidor
Copy link
Collaborator

lexidor commented May 20, 2020

I am going over old issues on this repository, to see which ones apply to the current versions of hhvm.

Hhvm does indeed produce a standard require_once failure with File not found.
I agree that php's Permission denied is a helpful piece of information when debugging.
I am hesitant to decide whether to close this issue, since we don't have to match php here, since they both end up producing a fatal error.

If anyone reading this believes that I should not have closed this issue, @lexidor me or create a new issue about the missing Permission denied warning.

@lexidor lexidor closed this as completed May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants