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 23:24 UTC
From: justinpatrin Assigned: avb
Status: Closed Package: HTTP_Client
PHP Version: Irrelevant OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2004-07-26 23:24 UTC] justinpatrin
Description: ------------ When a cookie has no path, a warning about strpos comes up. This was reported to me by Luke Barker <lukebarker@gmail.com>. A patch is available here: http://www.reversefold.com/PEAR/CookieManager.pathPatch.diff

Comments

 [2004-07-26 23: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 15: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 10: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 17: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 20: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 22:01 UTC] justinpatrin
Visit this URL for a demonstration, the source to reproduce the error, and a diff to fix the bug: http://www.reversefold.com/PEAR/HTTP_Client_bug_1987.php 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 13:21 UTC] avb
Fixed in CVS