Jump to content

Admin Settings and readdir() with ereg()


bsmither

Recommended Posts

Just installed PHP 5.3.3 (I did not take note when using lesser versions) and found unwanted entries in dropdowns that are created from the readdir() function. The dropdowns that use readdir() results are found in ten files. Some of the dropdowns are anything that selects a language or skin. Listing module folder names seems to work fine.

I believe the actual problem lies with ereg(), which is deprecated as of 5.3.0. In addition to the deprecated notices, I also get (never saw these before):

Warning: eregi() expects parameter 2 to be string, array given.

If the warning comes because of this:

if(!eregi($file,array(".",".."))){

maybe the warning causes the function to return FALSE (or at least not true).

From PHP.NET:

"Note: If the parameters given to a function are not what it expects, such as passing an array where a string is expected, the return value of the function is undefined. In this case it will likely return NULL but this is just a convention, and cannot be relied upon."

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...