Fix #41062: is_executable only looks at basic executables

This commit is contained in:
Christoph M. Becker 2021-11-08 15:04:41 +01:00
parent a0f0f0446d
commit 8d8cd43bfc
No known key found for this signature in database
GPG key ID: D66C9593118BCCB6

View file

@ -37,7 +37,8 @@
&reftitle.returnvalues;
<para>
Returns &true; if the filename exists and is executable, or &false; on
error.
error. On POSIX systems, a file is executable if the executable bit of the
file permissions is set. For Windows, see the note below.
</para>
</refsect1>
@ -74,6 +75,17 @@ if (is_executable($file)) {
&reftitle.notes;
&note.clearstatcache;
&tip.fopen-wrapper.stat;
<note>
<simpara>
On Windows, a file is considered executable, if it is a properly executable
file as reported by the Win API <literal>GetBinaryType()</literal>; for BC
reasons, files with a <filename>.bat</filename> or <filename>.cmd</filename>
extension are also considered executable. Prior to PHP 7.4.0, any non-empty
file with a <filename>.exe</filename> or <filename>.com</filename> extension
was considered executable. Note that <envar>PATHEXT</envar> is irrelevant
for <function>is_executable</function>.
</simpara>
</note>
</refsect1>
<refsect1 role="seealso">