Bug #19315 [Com]: removeDotSegments("0") not working
| From: | tklingenberg@lastflood.com | Date: | Sun, 04 Mar 2012 04:24:33 +0000 |
| Subject: | Bug #19315 [Com]: removeDotSegments("0") not working | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-8353@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19315&edit=1
ID: 19315
Comment by: tklingenberg@lastflood.com
Reported By: tklingenberg at lastflood dot com
Summary: removeDotSegments("0") not working
Status: Open
Type: Bug
Package: Net_URL2
Package Version: SVN
PHP Version: 5.3.10
Roadmap Versions:
New Comment:
I can't upload patches, so as comment:
Index: Net/URL2.php
===================================================================
--- Net/URL2.php (revision 323857)
+++ Net/URL2.php (revision )
@@ -757,7 +757,7 @@
// Make sure not to be trapped in an infinite loop due to a bug
in this
// method
$j = 0;
- while ($path && $j++ < 100) {
+ while (strlen($path) && $j++ < 100) {
if (substr($path, 0, 2) == './') {
// Step 2.A
$path = substr($path, 2);
Previous Comments:
------------------------------------------------------------------------
[2012-03-04 04:18:47] tkli
Description:
------------
The removeDotSegments has an implementation flaw taking the
string "0" as empty (bool check instead of strlen).
Test script:
---------------
echo Net_URL2::removeDotSegments("0"); # empty, not "0"
Expected result:
----------------
0
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19315&edit=1