FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Spaces in filenames
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Spaces in filenames [message #173701] Fri, 29 April 2011 23:00 Go to previous message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma:
Senior Member
When my app starts up, it discovers where it has been installed using:

$instdir = dirname (__FILE__);

Now, I have no control over where this might be in the file system, and
the user may well put it somewhere such that the path contains spaces.
I'm passing this round the app, and in the fullness of time may be doing
things like:

$fp = fopen ($instdir . "/wiggy", "r");

Does it matter to PHP filesystem functions if the filename contains
spaces?

But what's worse, I'll also be passing $instdir to shell scripts via
exec ().

Seems to me I can:

1) search/replace $instdir to escape spaces with backslash-space. But
does this mess up PHP filesystem functions?

2) leave $instdir as-is, but use escapeshellarg on it whenever I need to
pass it through exec().

Which is the better approach?

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PHP Runs In WinXP Command Window But Not In Browser
Next Topic: Html code beautifier
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 16:42:13 GMT 2024

Total time taken to generate the page: 0.04328 seconds