Skip to content

Conversation

@Girgias
Copy link
Member

@Girgias Girgias commented Nov 10, 2025

Include 8.5 deprecation for passing null to use the last opened directory.

Include 8.5 deprecation for passing null to use the last opened directory.
@mumumu mumumu added this to the PHP 8.5 milestone Nov 10, 2025
Comment on lines +93 to +101
<simpara>
Because file and directory names can be strings that PHP considers "falsy"
(e.g. a directory named <literal>"0"</literal>) and
<function>readdir</function> returns &false; when it has read all entries
in a directory one needs to use the <literal>===</literal>
<link linkend="language.operators.comparison">comparison operator</link>
to properly distinguish between a directory entry whose name is "falsy"
and having read all entries of the directory.
</simpara>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this need to be a warning or a note?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess so, maybe could even be a caution.

Comment on lines 125 to 131
<![CDATA[
filename: . : filetype: dir
filename: .. : filetype: dir
filename: apache : filetype: dir
filename: cgi : filetype: dir
filename: cli : filetype: dir
]]>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output doesn't match the code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't really have any output because it might be any filesystem, that's why we use the &example.outputs.similar; entity rather than &example.outputs;.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mean the file names. I meant the overal output structure is from the old example. You copied the other example without the copying the output also.

Comment on lines -88 to -107
<?php
if ($handle = opendir('/path/to/files')) {
echo "Directory handle: $handle\n";
echo "Entries:\n";
/* This is the correct way to loop over the directory. */
while (false !== ($entry = readdir($handle))) {
echo "$entry\n";
}
/* This is the WRONG way to loop over the directory. */
while ($entry = readdir($handle)) {
echo "$entry\n";
}
closedir($handle);
}
?>
]]>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You copied it from here and this didn't have the output section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants