[doc-en] master: Docs/filesize symbolic links (#6146)

From: Date: Wed, 25 Nov 2026 05:49:40 +0000
Subject: [doc-en] master: Docs/filesize symbolic links (#6146)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-24016@lists.php.net to get a copy of this message
Author: Malek Kadri (malekkadri) Committer: GitHub (web-flow) Pusher: lacatoire Date: 2026-11-25T06:49:36+01:00 Commit: https://github.com/php/doc-en/commit/f78595414f882dacb7d56c59b6243d9f1399fc3f Raw diff: https://github.com/php/doc-en/commit/f78595414f882dacb7d56c59b6243d9f1399fc3f.diff Docs/filesize symbolic links (#6146) * Document symbolic link handling in filesize * Document symbolic link handling in SplFileInfo::getSize Changed paths: M reference/filesystem/functions/filesize.xml M reference/spl/splfileinfo/getsize.xml Diff: diff --git a/reference/filesystem/functions/filesize.xml b/reference/filesystem/functions/filesize.xml index e7c14236be49..531a4245ed93 100644 --- a/reference/filesystem/functions/filesize.xml +++ b/reference/filesystem/functions/filesize.xml @@ -39,6 +39,13 @@ Returns the size of the file in bytes, or &false; (and generates an error of level <constant>E_WARNING</constant>) in case of an error. </para> + <simpara> + If <parameter>filename</parameter> is a symbolic link, the size of the + target is returned. If the target does not exist, &false; is returned + and an <constant>E_WARNING</constant> is emitted. + To obtain the size of the symbolic link itself, use the + <literal>size</literal> element of the array returned by <function>lstat</function>. + </simpara> &fs.file.32bit; </refsect1> @@ -79,6 +86,7 @@ echo $filename . ': ' . filesize($filename) . ' bytes'; <para> <simplelist> <member><function>file_exists</function></member> + <member><function>lstat</function></member> </simplelist> </para> </refsect1> diff --git a/reference/spl/splfileinfo/getsize.xml b/reference/spl/splfileinfo/getsize.xml index 7828b9e17209..d0317b274917 100644 --- a/reference/spl/splfileinfo/getsize.xml +++ b/reference/spl/splfileinfo/getsize.xml @@ -27,6 +27,13 @@ <para> The filesize in bytes on success, or &false; on failure. </para> + <simpara> + If the file is a symbolic link, the size of the target is returned. + If the target does not exist, a <exceptionname>RuntimeException</exceptionname> + is thrown. + To obtain the size of the symbolic link itself, use the + <literal>size</literal> element of the array returned by <function>lstat</function>. + </simpara> </refsect1> <refsect1 role="errors"> @@ -64,6 +71,7 @@ example.jpg 15385 <para> <simplelist> <member><function>filesize</function></member> + <member><function>lstat</function></member> </simplelist> </para> </refsect1>

« previous php.doc.cvs (#24016) next »