Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.1

Bug #1987 Warning when cookies have no path
Submitted: 2004-07-26 18:24 UTC Modified: 2006-12-26 23:29 UTC
From: justinpatrin Assigned: avb
Status: Closed Package: HTTP_Client
PHP Version: Irrelevant OS: Linux
Roadmaps: (Not assigned)    

 [2004-07-26 18:24 UTC] justinpatrin
Description: ------------ When a cookie has no path, a warning about strpos comes up. This was reported to me by Luke Barker <>. A patch is available here:


 [2004-07-26 18:39 UTC] justinpatrin
Ok, so I submitted that too fast. Looks like it should be the fault of the updateCookies() function as all cookies should have a path. Why is this funciton in there: $cookie['path'] = DIRECTORY_SEPARATOR == dirname($url->path)? '/': dirname($url->path); URLs should only have / in them according to standards, correct? If they don't, it depends upon the server, not the client, right? If this is so, DIRECTORY_SEPERATOR is a client value that you're checking against the server URL. Perhaps this should be changed? $cookie['path'] = $url->path; or $cookie['path'] = str_replace('\\', '/', $url->path); or something like that...
 [2004-08-10 10:43 UTC] avb
The DIRECTORY_SEPARATOR-related code is in fact OK, as using dirname() on a 'top-level' directory on win32 platform yields '\', but it leaves slashes in other paths intact. What about the original bug report? Should I close it?
 [2004-09-15 05:31 UTC] avb
No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you.
 [2004-09-15 12:06 UTC] justinpatrin
You say that it's ok, but I still don't understand why. Aren't URLs supposed to use only '/' for directory separation?
 [2004-09-15 15:41 UTC] avb
The following code echo dirname('/foo'); will print '/' on Unix and '\' on Windows, that's how PHP's dirname() works. I'm closing the bug as Bogus, which I should have really done right away, since it does not contain any reproduce code. Please do not reopen it unless you can provide such code.
 [2004-09-15 17:01 UTC] justinpatrin
Visit this URL for a demonstration, the source to reproduce the error, and a diff to fix the bug: I realize that the path usually is not sent as nothing, but I ran into it with some webservers. I've dropped the \ issue for now, perhaps I'll open another bug report.
 [2004-10-04 08:21 UTC] avb
Fixed in CVS