Re: #22399 [Asn]: file_exists : example given of shared path format is obviously defective

From: Date: Mon, 03 Mar 2003 17:40:21 +0000
Subject: Re: #22399 [Asn]: file_exists : example given of shared path format is obviously defective
References: 1 2  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969352091@lists.php.net to get a copy of this message
True. I didn't really think about that one. I'm sorry if I sounded a bit angry with you in my previous post. Anyway: I've removed all single quotes from the paths now so there should be no confusion about how the path is formatted. If the user wants to put the path in a string, he/she will have to escape it any way he/she wants to. Victor ----- Original Message ----- From: "Edin Kadribasic" <edink@proventum.net> To: <phpdoc@lists.php.net>; <victor@php.net> Sent: Monday, March 03, 2003 2:21 PM Subject: Re: [PHP-DOC] #22399 [Asn]: file_exists : example given of shared path format is obviously defective > Your example was not right since you get only one leading backslash > which doesn't indicate computer name. Ie echo > '\\computername\share\filename' will print > \computername\share\filename which is not desired in this context. > > This is because in singe quoted there are *two* special cases \\ and > \' > > Edin > > ----- Original Message ----- > From: <victor@php.net> > To: <phpdoc@lists.php.net> > Sent: Monday, March 03, 2003 9:02 AM > Subject: [PHP-DOC] #22399 [Asn]: file_exists : example given of > shared path format is obviously defective > > > > ID: 22399 > > Updated by: victor@php.net > > Reported By: alan at frostick dot com > > Status: Assigned > > Bug Type: Documentation problem > > Operating System: WIN32 > > PHP Version: 4.3.1 > > Assigned To: victor > > New Comment: > > > > Well, ... > > > > You _are_ right that I _should_ do that, but you actually only > have to > > escape backslashes in a single quote when they are at the end of > the > > string (or escaping single quotes in a single quoted string). So > there > > is actually no errors in my example. ref: > > http://www.php.net/manual/en/language.types.string.php > > > > What I think is best is to write \\computername\share\filename > without > > the quotes and hope that the user is intelligent enought to > understand > > that the path has to be escaped properly when put inside double > quotes. > > Any other suggestions? > > > > > > Previous Comments: > > ------------------------------------------------------------------ > ------ > > > > [2003-03-02 17:49:26] edink@php.net > > > > Wrong! You need to escape backslash character in any type of php > > string, including string in single quotes. So the correct way to > write > > it would be: > > > > '\\\\computername\\share\\filename' > > > > ------------------------------------------------------------------ > ------ > > > > [2003-03-02 04:48:20] victor@php.net > > > > I've changed \\\\computername\share\filename to > > \\computername\share\filename and put every example in single > quotes to > > make it more even more clear. > > > > ------------------------------------------------------------------ > ------ > > > > [2003-02-25 16:29:31] stone@php.net > > > > Sorry, I changed submitter's e-mail. > > > > ------------------------------------------------------------------ > ------ > > > > [2003-02-25 16:27:17] stone@php.net > > > > At least "//server/share/filename/" had been working starting from > > 4.1.0 while '\\server\share\filename' didn't for quite a long time > > (until 4.2.0?). > > If you want to write cross plattform code it's not a bad idea to > rely > > on php's auto conversion of slashes to backslashes in file paths > on > > windows platforms. > > > > ------------------------------------------------------------------ > ------ > > > > [2003-02-24 17:55:00] php at mijav dot dk > > > > I partially agree. I agree that it's incorrect. But the correct > way > > should be '\\computername\share\filename' in plings, or > > "\\\\computername\\share\\filename" in quotes, as you said. > > I don't think the manual should read \\\\ (escaped backslashes) > unless > > it is writtenly-quoted, to avoid misunderstanding. > > > > ------------------------------------------------------------------ > ------ > > > > The remainder of the comments for this report are too long. To > view > > the rest of the comments, please view the bug report online at > > http://bugs.php.net/22399 > > > > -- > > Edit this bug report at > > http://bugs.php.net/?id=22399&edit=1 > > > > > > -- > > PHP Documentation Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > PHP Documentation Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

« previous php.doc (#969352091) next »