Under what circumstances does the rename function of php output an error of Operation not permitted instead of a warning?

basic environment
Ubuntu 16.04.1
apache 2.4
php 7.1.7

the root directory of the php file is a directory under a windows machine mounted through samba

//192.168.44.1/dev/144 on /home/wwwroot type cifs (rw,nosuid,nodev,noexec,relatime,vers=default,cache=none,domain=,uid=0,forceuid,gid=0,forcegid,addr=192.168.44.1,file_mode=0777,dir_mode=0777,nounix,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,actimeo=1)
The

directory itself is accessible. Have all rw permissions, but not x permissions

part of the error report.

84:        if(file_exists($targetPath))return true;
85:        if (!$tran) return rename($fromPath, $targetPath);
[2018-03-26 09:44:45] local.ERROR: ErrorException: rename(/tmp/php2aXCEp,/home/wwwroot/cm/public_static/upload/user/1b/11384324d7be4098700a14ecfb418a.png): Operation not permitted in /home/wwwroot/cm/app/Helpers/FileReceiver.php:85

http://php.net/manual/en/func.

according to the documentation, rename to unsupported file systems after version 4.3.3 "may" generate a warning.
but now the situation is that this function directly throws an error, but the file is copied successfully.
there are also several guys in the same situation at the bottom of this official document [that is, they are all trampled at the bottom. " Adding @ and re-file_exists can basically solve the problem, but how did this happen?

Mar.18,2021

I haven't been in charge of this matter for a long time. Answer your own questions.
looked through the comments and said that it was actually an issue of fat file system permissions. It is said that it cannot be called bug. But anyway, just be careful.
refer to ben at indietorrent dot org's answer.
that is, such an error occurs when copying to a file system in fat format.

From the Changelog notes:

"Warnings may be generated if the destination filesystem doesn't permit chown() or chmod() system calls to be made on files  for example, if the destination filesystem is a FAT filesystem."

More explicitly, rename() may still return (bool) true, despite the warnings that result from the underlying calls to chown() or chmod(). This behavior can be misleading absent a deeper understanding of the underlying mechanics. To rename across filesystems, PHP "fakes it" by calling copy(), unlink(), chown(), and chmod() (not necessarily in that order). See PHP bug -sharp50676 for more information.

On UNIX-like operating systems, filesystems may be mounted with an explicit uid and/or gid (for example, with mount options "uid=someuser,gid=somegroup"). Attempting to call rename() with such a destination filesystem will cause an "Operation not permitted" warning, even though the file is indeed renamed and rename() returns (bool) true.

This is not a bug. Either handle the warning as is appropriate to your use-case, or call copy() and then unlink(), which will avoid the doomed calls to chown() and chmod(), thereby eliminating the warning.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37640-34458.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37640-34458.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?