The original post: /r/php by /u/edhelatar on 2025-03-11 23:19:06.
Hey. I just learned something new.
php file_get_contents('~/file.txt') = false file_get_contents('/home/file.txt') = _file.txt contents
What’s weirder is
realpath('~/file.txt') = false
realpath ~/file.txt = /home/file.txt ( backtick is exec )
Anybody have any idea what’s up? Working on some scripting library and never noticed that before. Seems like a weird behaviour, but cannot find any bug reports / conversations about home path not being resolved. Don’t see that also as a security issue really.
You must log in or # to comment.