mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
dirname(): add warning about risk of infinite loop
Co-authored-by: jrfnl <jrfnl@users.noreply.github.com> Closes GH-1005.
This commit is contained in:
parent
41c8533ff5
commit
67ca0d930c
1 changed files with 19 additions and 0 deletions
|
@ -82,6 +82,25 @@
|
|||
<parameter>path</parameter> with any trailing
|
||||
<literal>/component</literal> removed.
|
||||
</para>
|
||||
|
||||
<caution>
|
||||
<para>
|
||||
Be careful when using this function in a loop that can reach the
|
||||
top-level directory as this can result in an infinite loop.
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
dirname('.'); // Will return '.'.
|
||||
dirname('/'); // Will return `\` on Windows and '/' on *nix systems.
|
||||
dirname('\\'); // Will return `\` on Windows and '.' on *nix systems.
|
||||
dirname('C:\\'); // Will return 'C:\' on Windows and '.' on *nix systems.
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
</caution>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="changelog">
|
||||
|
|
Loading…
Reference in a new issue