iliaa           Mon Oct 13 00:28:35 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/ext/standard/tests/strings url_t.phpt 
    /php-src/ext/standard       url.c 
    /php-src    NEWS 
  Log:
  MFH: Fixed bug #25800 (parse_url() could not parse urls with empty port).
  
  
Index: php-src/ext/standard/tests/strings/url_t.phpt
diff -u php-src/ext/standard/tests/strings/url_t.phpt:1.3.2.4 
php-src/ext/standard/tests/strings/url_t.phpt:1.3.2.5
--- php-src/ext/standard/tests/strings/url_t.phpt:1.3.2.4       Mon Jul 21 09:37:10 
2003
+++ php-src/ext/standard/tests/strings/url_t.phpt       Mon Oct 13 00:28:32 2003
@@ -67,7 +67,8 @@
 'http://user:[EMAIL PROTECTED]:8080?bar=1&boom=0',
 'file:///path/to/file',
 'file://path/to/file',
-'file:/path/to/file'
+'file:/path/to/file',
+'http://1.2.3.4:/abc.asp?a=1&b=2'
 );
 
     foreach ($sample_urls as $url) {
@@ -638,4 +639,14 @@
   string(4) "file"
   ["path"]=>
   string(13) "/path/to/file"
+}
+array(4) {
+  ["scheme"]=>
+  string(4) "http"
+  ["host"]=>
+  string(7) "1.2.3.4"
+  ["path"]=>
+  string(8) "/abc.asp"
+  ["query"]=>
+  string(7) "a=1&b=2"
 }
Index: php-src/ext/standard/url.c
diff -u php-src/ext/standard/url.c:1.58.2.8 php-src/ext/standard/url.c:1.58.2.9
--- php-src/ext/standard/url.c:1.58.2.8 Mon Jul 21 09:37:10 2003
+++ php-src/ext/standard/url.c  Mon Oct 13 00:28:33 2003
@@ -15,7 +15,7 @@
    | Author: Jim Winstead <[EMAIL PROTECTED]>                                  |
    +----------------------------------------------------------------------+
  */
-/* $Id: url.c,v 1.58.2.8 2003/07/21 13:37:10 iliaa Exp $ */
+/* $Id: url.c,v 1.58.2.9 2003/10/13 04:28:33 iliaa Exp $ */
 
 #include <stdlib.h>
 #include <string.h>
@@ -197,17 +197,17 @@
        if ((p = memchr(s, ':', (e-s)))) {
                if (!ret->port) {
                        p++;
-                       if ( e-p > 5 || e-p < 1 ) { /* port cannot be longer then 5 
characters */
+                       if (e-p > 5) { /* port cannot be longer then 5 characters */
                                STR_FREE(ret->scheme);
                                STR_FREE(ret->user);
                                STR_FREE(ret->pass);
                                efree(ret);
                                return NULL;
+                       } else if (e - p > 0) {
+                               memcpy(port_buf, p, (e-p));
+                               port_buf[e-p] = '\0';
+                               ret->port = atoi(port_buf);
                        }
-               
-                       memcpy(port_buf, p, (e-p));
-                       port_buf[e-p] = '\0';
-                       ret->port = atoi(port_buf);
                        p--;
                }       
        } else {
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.434 php-src/NEWS:1.1247.2.435
--- php-src/NEWS:1.1247.2.434   Sun Oct 12 19:49:34 2003
+++ php-src/NEWS        Mon Oct 13 00:28:34 2003
@@ -5,6 +5,7 @@
   POSIX compatible mode. (K.Kosako <kosako at sofnec.co.jp>, Moriyoshi)
 - Fixed bug #25814 (Make flock() return correct value when 3rd argument is
   used). (Ilia)
+- Fixed bug #25800 (parse_url() could not parse urls with empty port). (Ilia)
 - Fixed bug #25780 (ext/session: invalid "session.cookie_lifetime" makes 
   session_start() to crash in win32). (Jani)
 - Fixed bug #25770 (Segfault with PHP and bison 1.875). ([EMAIL PROTECTED], Marcus)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to