Bug #68280 [NEW]: PHAR temp path being shared across virtualhosts with open_basedir

From: Date: Tue, 21 Oct 2014 23:00:34 +0000
Subject: Bug #68280 [NEW]: PHAR temp path being shared across virtualhosts with open_basedir
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188240@lists.php.net to get a copy of this message
From: scuzzy at gmail dot com Operating system: Windows 7 Version 6.1.7601 PHP version: 5.5.18 Package: PHAR related Bug Type: Bug Bug description:PHAR temp path being shared across virtualhosts with open_basedir Description: ------------ I have two websites, both with their own sys_temp_dir and open_basedir settings. I am then trying to load an amazon aws.phar file (each site has it's own copy of the archive) When executed, the first website (PharA) will function and behave normally. The second website when executed (PharB) will get open_basedir errors trying to access a temporary file outside of its path that was generated/cached by the first website (PharA) I have this simple apache config to create two websites "PharA" and "PharB" <VirtualHost *:80> DocumentRoot "C:/WebRoot/PharA/web" ServerName PharA <Directory "C:/WebRoot/PharA/web"> php_admin_value open_basedir "C:/WebRoot/PharA/web;C:/WebRoot/PharA/tmp;" php_admin_value upload_tmp_dir "C:/WebRoot/PharA/tmp" php_admin_value sys_temp_dir "C:/WebRoot/PharA/tmp" </Directory> </VirtualHost> <VirtualHost *:80> DocumentRoot "C:/WebRoot/PharB/web" ServerName PharB <Directory "C:/WebRoot/PharB/web"> php_admin_value open_basedir "C:/WebRoot/PharB/web;C:/WebRoot/PharB/tmp" php_admin_value upload_tmp_dir "C:/WebRoot/PharB/tmp" php_admin_value sys_temp_dir "C:/WebRoot/PharB/tmp" </Directory> </VirtualHost> I then had this as a hosts entry 127.0.0.1 phara 127.0.0.1 pharb Test script: --------------- <?php // Phar downloaded from https://github.com/aws/aws-sdk-php/releases/tag/2.7.1 require('aws.phar'); use Aws\S3\S3Client; use Aws\Common\Enum\Region; $client = S3Client::factory(array( 'key' => '[KEY]', 'secret' => '[SECRET]', 'region' => Region::AP_SOUTHEAST_2 )); Actual result: -------------- After browsing http://phara/ first followed by browsing to http://pharb/ afterwards, I see this error and incorrect temp path in http://pharb/ Warning: file_exists(): open_basedir restriction in effect. File(C:/WebRoot/PharA/tmp/guzzle-cacert.pem) is not within the allowed path(s): (C:/WebRoot/PharB/web;C:/WebRoot/PharB/tmp) in phar://C:/WebRoot/PharB/web/aws.phar/Guzzle/Http/Client.php on line 511 Likewise if I restart apache, then browse http://pharb/ first the error will then occur under http://phara/ switching positions depending on which site was executed first (almost as if PHP keeps a index of paths for the phar file it processes) -- Edit bug report at https://bugs.php.net/bug.php?id=68280&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68280&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68280&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68280&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=68280&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=68280&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=68280&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=68280&r=needscript Try newer version: https://bugs.php.net/fix.php?id=68280&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=68280&r=support Expected behavior: https://bugs.php.net/fix.php?id=68280&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=68280&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=68280&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=68280&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68280&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=68280&r=dst IIS Stability: https://bugs.php.net/fix.php?id=68280&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=68280&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=68280&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=68280&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=68280&r=mysqlcfg

« previous php.bugs (#188240) next »