Bug #81404 [NEW]: rename() does not keep extended file attributes

From: Date: Tue, 31 Aug 2021 17:05:18 +0000
Subject: Bug #81404 [NEW]: rename() does not keep extended file attributes
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236199@lists.php.net to get a copy of this message
From: rdueck at mcmillan-mcgee dot com Operating system: Debian 10, Linux 4.19.0-17-amd64 PHP version: 8.0.10 Package: *General Issues Bug Type: Bug Bug description:rename() does not keep extended file attributes Description: ------------ When running from Apache2 using apache-mod-php, rename() strips extended attributes. The same code works from the command line, and the system 'mv' command works in both cases. move_uploaded_file() has the same problem as rename(). Test script: --------------- <?php // Requires xattr: // pecl install xattr // then add 'extension=xattr.so' to php.ini // ASSUME: current directory is not /tmp $a = tempnam('/tmp','my'); $b = basename($a); for ($i=0; $i<2; $i++) { file_put_contents($a,'TestData'); xattr_set($a,'owner','me'); switch($i){ case 0: rename($a,$b); $fn='rename'; break; case 1: mv $a $b; $fn='mv'; break; } $owner = xattr_get($b,'owner'); echo "$fn ".($owner=='me'?'SUCCEEDED':'FAILED')."\n"; } Expected result: ---------------- rename SUCCEEDED mv SUCCEEDED Actual result: -------------- rename FAILED mv SUCCEEDED -- Edit bug report at https://bugs.php.net/bug.php?id=81404&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81404&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81404&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81404&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81404&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81404&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81404&r=support Expected behavior: https://bugs.php.net/fix.php?id=81404&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81404&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81404&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81404&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81404&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81404&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81404&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81404&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81404&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81404&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81404&r=mysqlcfg

« previous php.bugs (#236199) next »