Bug #71055 [NEW]: Intepreter compiled with litespeed SAPI breaks __DIR__ in CLI

From: Date: Tue, 08 Dec 2015 10:25:41 +0000
Subject: Bug #71055 [NEW]: Intepreter compiled with litespeed SAPI breaks __DIR__ in CLI
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197684@lists.php.net to get a copy of this message
From: grzegorz129 at gmail dot com Operating system: Linux x64 PHP version: 7.0.0 Package: Scripting Engine problem Bug Type: Bug Bug description:Intepreter compiled with litespeed SAPI breaks __DIR__ in CLI Description: ------------ I have PHP 7 compiled with litespeed SAPI support. Binary works as expected while used with webserver, but acts weird while invoked from console. That bug was introduced in 7.0.0 release and wasn't present in RC8. First of all I tested if __DIR__ implementation is consistent between all PHP versions: https://3v4l.org/1lRa2 - yup, it is. Next I created file inside app catalog named test.php. Than I invoked it from outside of the app directory: root@server:/home/[redacted]# php app/test.php string(19) "/home/[redacted]/app" root@server:/home/[redacted]# php7 app/test.php string(23) "/home/[redacted]/app/app" # php --version PHP 5.6.11 (cli) (built: Jul 13 2015 01:48:23) (DEBUG) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies # php7 -v PHP 7.0.0 (litespeed) (built: Dec 4 2015 10:46:45) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies PHP also thinks files are located elsewhere: require_once(/home/[redacted]/app/app/bootstrap.php.cache): failed to open stream: No such file or directory in /home/[redacted]/app/app/console on line 10 RC8 looks correct though: # php7 test/test.php string(10) "/home/test" # php7 --version PHP 7.0.0RC8 (cli) (built: Dec 2 2015 14:03:35) ( NTS ) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies I also spot one difference which may be relevant - running binary from console final version identifies SAPI as "litespeed" while RC8 reports "cli". Configuration ------------- Configuration is identical on both servers. Compilation options: './configure' '--prefix=/usr/local/lsws/lsphp7' '--with-libdir=/lib/x86_64-linux-gnu' '--with-curl' '--with-gd' '--enable-exif' '--enable-gd-native-ttf' '--with-freetype-dir=/usr/lib/x86_64-linux-gnu' '--with-ttf' '--with-gettext' '--with-jpeg-dir=/usr/include' '--with-libpng' '--with-openssl' '--with-mcrypt' '--with-mhash' '--with-mysql=/usr' '--with-mysqli' '--with-pdo-mysql' '--with-pdo-pgsql' '--with-pear' '--with-zlib' '--enable-zip' '--with-bz2' '--with-iconv' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--with-gmp' '--enable-sockets' '--enable-intl' '--enable-mbstring' '--with-mcrypt=/usr' '--enable-opcache' '--with-litespeed' PHP.ini: memory_limit = 256M date.timezone = "Europe/Warsaw" post_max_size = 16M upload_max_filesize = 10M max_execution_time = 120 enable_dl = Off expose_php = Off intl.default_locale = "pl_PL.UTF-8" mysql.connect_timeout = 5 mysql.default_host = localhost session.cookie_httponly = On session.use_only_cookies = On opcache.enable=1 opcache.memory_consumption=128 opcache.max_accelerated_files=4000 Test script: --------------- <?php //Save in it eg. test/test.php and call using php7 test/test.php //DO NOT enter test directory var_dump(__DIR__); -- Edit bug report at https://bugs.php.net/bug.php?id=71055&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71055&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71055&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71055&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71055&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71055&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71055&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71055&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71055&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71055&r=support Expected behavior: https://bugs.php.net/fix.php?id=71055&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71055&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71055&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71055&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71055&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71055&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71055&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71055&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71055&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71055&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71055&r=mysqlcfg

« previous php.bugs (#197684) next »