[PHP-CVS] cvs: php-src /ext/mysql php_mysql.c

2006-11-19 Thread Georg Richter
georg   Sun Nov 19 12:10:19 2006 UTC

  Modified files:  
/php-src/ext/mysql  php_mysql.c 
  Log:
  added unicode support for ext/mysql
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/php_mysql.c?r1=1.226r2=1.227diff_format=u
Index: php-src/ext/mysql/php_mysql.c
diff -u php-src/ext/mysql/php_mysql.c:1.226 php-src/ext/mysql/php_mysql.c:1.227
--- php-src/ext/mysql/php_mysql.c:1.226 Sun Oct  8 13:34:22 2006
+++ php-src/ext/mysql/php_mysql.c   Sun Nov 19 12:10:19 2006
@@ -18,7 +18,7 @@
+--+
 */
  
-/* $Id: php_mysql.c,v 1.226 2006/10/08 13:34:22 bjori Exp $ */
+/* $Id: php_mysql.c,v 1.227 2006/11/19 12:10:19 georg Exp $ */
 
 /* TODO:
  *
@@ -473,6 +473,7 @@
 static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
 {
char *user=NULL, *passwd=NULL, *host_and_port=NULL, *socket=NULL, 
*tmp=NULL, *host=NULL;
+   int  user_len, passwd_len, host_len;
char *hashed_details=NULL;
int hashed_details_length, port = MYSQL_PORT;
int client_flags = 0;
@@ -480,7 +481,6 @@
 #if MYSQL_VERSION_ID = 32230
void (*handler) (int);
 #endif
-   zval **z_host=NULL, **z_user=NULL, **z_passwd=NULL, **z_new_link=NULL, 
**z_client_flags=NULL;
zend_bool free_host=0, new_link=0;
long connect_timeout;
 
@@ -521,95 +521,22 @@
user = MySG(default_user);
passwd = MySG(default_password);

-   switch(ZEND_NUM_ARGS()) {
-   case 0: /* defaults */
-   break;
-   case 1: {   
-   if (zend_get_parameters_ex(1, 
z_host)==FAILURE) {
-   MYSQL_DO_CONNECT_RETURN_FALSE();
-   }
-   }
-   break;
-   case 2: {
-   if (zend_get_parameters_ex(2, z_host, 
z_user)==FAILURE) {
-   MYSQL_DO_CONNECT_RETURN_FALSE();
-   }
-   convert_to_string_ex(z_user);
-   user = Z_STRVAL_PP(z_user);
-   }
-   break;
-   case 3: {
-   if (zend_get_parameters_ex(3, z_host, 
z_user, z_passwd) == FAILURE) {
-   MYSQL_DO_CONNECT_RETURN_FALSE();
-   }
-   convert_to_string_ex(z_user);
-   convert_to_string_ex(z_passwd);
-   user = Z_STRVAL_PP(z_user);
-   passwd = Z_STRVAL_PP(z_passwd);
-   }
-   break;
-   case 4: {
-   if (!persistent) {
-   if (zend_get_parameters_ex(4, 
z_host, z_user, z_passwd, z_new_link) == FAILURE) {
-   
MYSQL_DO_CONNECT_RETURN_FALSE();
-   }
-   convert_to_string_ex(z_user);
-   convert_to_string_ex(z_passwd);
-   
convert_to_boolean_ex(z_new_link);
-   user = Z_STRVAL_PP(z_user);
-   passwd = Z_STRVAL_PP(z_passwd);
-   new_link = 
Z_BVAL_PP(z_new_link);
-   }
-   else {
-   if (zend_get_parameters_ex(4, 
z_host, z_user, z_passwd, z_client_flags) == FAILURE) {
-   
MYSQL_DO_CONNECT_RETURN_FALSE();
-   }
-   convert_to_string_ex(z_user);
-   convert_to_string_ex(z_passwd);
-   
convert_to_long_ex(z_client_flags);
-   user = Z_STRVAL_PP(z_user);
-   passwd = Z_STRVAL_PP(z_passwd);
-   client_flags = 
Z_LVAL_PP(z_client_flags);
-   }
-   }
-   break;
-   case 5: {
-   if 

[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/standard pack.c /ext/standard/tests/strings bug38770.phpt

2006-11-19 Thread Ilia Alshanetsky
iliaa   Sun Nov 19 18:20:48 2006 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/standard/tests/strings bug38770.phpt 

  Modified files:  
/php-srcNEWS 
/php-src/ext/standard   pack.c 
  Log:
  Fixed bug #38770 (unpack() broken with longs on 64 bit machines).
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.367r2=1.2027.2.547.2.368diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.367 php-src/NEWS:1.2027.2.547.2.368
--- php-src/NEWS:1.2027.2.547.2.367 Fri Nov 17 11:40:52 2006
+++ php-src/NEWSSun Nov 19 18:20:48 2006
@@ -74,6 +74,8 @@
   (Dmitry)
 - Fixed bug #39090 (DirectoryFilterDots doxygen docs and example is wrong).
   (Marcus)
+- Fixed bug #38770 (unpack() broken with longs on 64 bit machines). (Ilia,
+  David Soria Parra).
 - Fixed bug #38698 (for some keys cdbmake creates corrupted db and cdb can't 
   read valid db). (Marcus)
 - Fixed bug #38680 (Added missing handling of basic types in json_decode).
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/pack.c?r1=1.57.2.5r2=1.57.2.5.2.1diff_format=u
Index: php-src/ext/standard/pack.c
diff -u php-src/ext/standard/pack.c:1.57.2.5 
php-src/ext/standard/pack.c:1.57.2.5.2.1
--- php-src/ext/standard/pack.c:1.57.2.5Sun Feb 26 10:49:50 2006
+++ php-src/ext/standard/pack.c Sun Nov 19 18:20:48 2006
@@ -15,7 +15,7 @@
| Author: Chris Schneider [EMAIL PROTECTED]  |
+--+
  */
-/* $Id: pack.c,v 1.57.2.5 2006/02/26 10:49:50 helly Exp $ */
+/* $Id: pack.c,v 1.57.2.5.2.1 2006/11/19 18:20:48 iliaa Exp $ */
 
 #include php.h
 
@@ -753,14 +753,16 @@
 
case 'i': 
case 'I': {
-   long v;
+   long v = 0;
int issigned = 0;
 
if (type == 'i') {
issigned = 
input[inputpos + (machine_little_endian ? (sizeof(int) - 1) : 0)]  0x80;
-   }
+   } else if (sizeof(long)  4  
(input[inputpos + machine_endian_long_map[3]]  0x80) == 0x80) {
+   v = ~INT_MAX;
+}
 
-   v = 
php_unpack(input[inputpos], sizeof(int), issigned, int_map);
+   v |= 
php_unpack(input[inputpos], sizeof(int), issigned, int_map);
add_assoc_long(return_value, n, 
v);
break;
}
@@ -771,7 +773,7 @@
case 'V': {
int issigned = 0;
int *map = 
machine_endian_long_map;
-   long v;
+   long v = 0;
 
if (type == 'l') {
issigned = 
input[inputpos + (machine_little_endian ? 3 : 0)]  0x80;
@@ -781,7 +783,11 @@
map = 
little_endian_long_map;
}
 
-   v = 
php_unpack(input[inputpos], 4, issigned, map);
+   if (sizeof(long)  4  
(input[inputpos + machine_endian_long_map[3]]  0x80) == 0x80) {
+   v = ~INT_MAX;
+   }
+
+   v |= 
php_unpack(input[inputpos], 4, issigned, map);
add_assoc_long(return_value, n, 
v);
break;
}

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug38770.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/bug38770.phpt
+++ php-src/ext/standard/tests/strings/bug38770.phpt

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



[PHP-CVS] cvs: php-src /ext/standard pack.c /ext/standard/tests/strings bug38770.phpt

2006-11-19 Thread Ilia Alshanetsky
iliaa   Sun Nov 19 18:21:50 2006 UTC

  Modified files:  
/php-src/ext/standard/tests/strings bug38770.phpt 
/php-src/ext/standard   pack.c 
  Log:
  MFB: Fixed bug #38770 (unpack() broken with longs on 64 bit machines).
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug38770.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/standard/tests/strings/bug38770.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/bug38770.phpt:1.2
--- /dev/null   Sun Nov 19 18:21:50 2006
+++ php-src/ext/standard/tests/strings/bug38770.phptSun Nov 19 18:21:50 2006
@@ -0,0 +1,25 @@
+--TEST--
+Bug #38770 (unpack() broken with longs on 64 bit machines)
+--FILE--
+?php
+
+foreach (array('N','I','l') as $v) {
+   print_r(unpack($v, pack($v, -3)));
+}
+
+echo Done\n;
+?
+--EXPECT-- 
+Array
+(
+[1] = -3
+)
+Array
+(
+[1] = -3
+)
+Array
+(
+[1] = -3
+)
+Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/pack.c?r1=1.62r2=1.63diff_format=u
Index: php-src/ext/standard/pack.c
diff -u php-src/ext/standard/pack.c:1.62 php-src/ext/standard/pack.c:1.63
--- php-src/ext/standard/pack.c:1.62Sun Feb 19 18:19:33 2006
+++ php-src/ext/standard/pack.c Sun Nov 19 18:21:50 2006
@@ -15,7 +15,7 @@
| Author: Chris Schneider [EMAIL PROTECTED]  |
+--+
  */
-/* $Id: pack.c,v 1.62 2006/02/19 18:19:33 iliaa Exp $ */
+/* $Id: pack.c,v 1.63 2006/11/19 18:21:50 iliaa Exp $ */
 
 #include php.h
 
@@ -752,14 +752,16 @@
 
case 'i': 
case 'I': {
-   long v;
+   long v = 0;
int issigned = 0;
 
if (type == 'i') {
issigned = 
input[inputpos + (machine_little_endian ? (sizeof(int) - 1) : 0)]  0x80;
-   }
+   } else if (sizeof(long)  4  
(input[inputpos + machine_endian_long_map[3]]  0x80) == 0x80) {
+   v = ~INT_MAX;
+}
 
-   v = 
php_unpack(input[inputpos], sizeof(int), issigned, int_map);
+   v |= 
php_unpack(input[inputpos], sizeof(int), issigned, int_map);
add_assoc_long(return_value, n, 
v);
break;
}
@@ -770,7 +772,7 @@
case 'V': {
int issigned = 0;
int *map = 
machine_endian_long_map;
-   long v;
+   long v = 0;
 
if (type == 'l') {
issigned = 
input[inputpos + (machine_little_endian ? 3 : 0)]  0x80;
@@ -780,7 +782,11 @@
map = 
little_endian_long_map;
}
 
-   v = 
php_unpack(input[inputpos], 4, issigned, map);
+   if (sizeof(long)  4  
(input[inputpos + machine_endian_long_map[3]]  0x80) == 0x80) {
+   v = ~INT_MAX;
+   }
+
+   v |= 
php_unpack(input[inputpos], 4, issigned, map);
add_assoc_long(return_value, n, 
v);
break;
}

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard/tests/strings pack.phpt

2006-11-19 Thread Ilia Alshanetsky
iliaa   Sun Nov 19 18:31:07 2006 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/standard/tests/strings pack.phpt 
  Log:
  pack()/unpack() tests
  
  

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/pack.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/strings/pack.phpt
+++ php-src/ext/standard/tests/strings/pack.phpt

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



[PHP-CVS] cvs: php-src /ext/standard/tests/strings pack.phpt

2006-11-19 Thread Ilia Alshanetsky
iliaa   Sun Nov 19 18:31:22 2006 UTC

  Modified files:  
/php-src/ext/standard/tests/strings pack.phpt 
  Log:
  MFB: pack()/unpack() tests
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/pack.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/standard/tests/strings/pack.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/pack.phpt:1.2
--- /dev/null   Sun Nov 19 18:31:22 2006
+++ php-src/ext/standard/tests/strings/pack.phptSun Nov 19 18:31:22 2006
@@ -0,0 +1,379 @@
+--TEST--
+Generic pack()/unpack() tests
+--FILE--
+?php
+print_r(unpack(A, pack(A, hello world)));
+print_r(unpack(A*, pack(A*, hello world)));
+echo ''.pack(A9, hello).'';
+echo \n;
+
+print_r(unpack(C, pack(C, -127)));
+print_r(unpack(C, pack(C, 127)));
+print_r(unpack(C, pack(C, 255)));
+print_r(unpack(C, pack(C, -129)));
+
+print_r(unpack(H, pack(H, 0x04)));
+
+print_r(unpack(I, pack(I, 65534)));
+print_r(unpack(I, pack(I, 0)));
+print_r(unpack(I, pack(I, -1000)));
+print_r(unpack(I, pack(I, -64434)));
+print_r(unpack(I, pack(I, 4294967296)));
+print_r(unpack(I, pack(I, -4294967296)));
+
+print_r(unpack(L, pack(L, 65534)));
+print_r(unpack(L, pack(L, 0)));
+print_r(unpack(L, pack(L, 2147483650)));
+print_r(unpack(L, pack(L, 4294967295)));
+print_r(unpack(L, pack(L, -2147483648)));
+
+print_r(unpack(N, pack(N, 65534)));
+print_r(unpack(N, pack(N, 0)));
+print_r(unpack(N, pack(N, 2147483650)));
+print_r(unpack(N, pack(N, 4294967296)));
+print_r(unpack(N, pack(N, -2147483648)));
+print_r(unpack(N, pack(N, -3)));
+
+print_r(unpack(S, pack(S, 65534)));
+print_r(unpack(S, pack(S, 65537)));
+print_r(unpack(S, pack(S, 0)));
+print_r(unpack(S, pack(S, -1000)));
+print_r(unpack(S, pack(S, -64434)));
+print_r(unpack(S, pack(S, -65535)));
+
+print_r(unpack(V, pack(V, 65534)));
+print_r(unpack(V, pack(V, 0)));
+print_r(unpack(V, pack(V, 2147483650)));
+print_r(unpack(V, pack(V, 4294967296)));
+print_r(unpack(V, pack(V, -2147483648)));
+
+print_r(unpack(a, pack(a, hello world)));
+print_r(unpack(a*, pack(a*, hello world)));
+
+print_r(unpack(c, pack(c, -127)));
+print_r(unpack(c, pack(c, 127)));
+print_r(unpack(c, pack(c, 255)));
+print_r(unpack(c, pack(c, -129)));
+
+print_r(unpack(h, pack(h, 300)));
+
+print_r(unpack(i, pack(i, 65534)));
+print_r(unpack(i, pack(i, 0)));
+print_r(unpack(i, pack(i, -1000)));
+print_r(unpack(i, pack(i, -64434)));
+print_r(unpack(i, pack(i, -65535)));
+print_r(unpack(i, pack(i, -2147483647)));
+
+print_r(unpack(l, pack(l, 65534)));
+print_r(unpack(l, pack(l, 0)));
+print_r(unpack(l, pack(l, 2147483650)));
+print_r(unpack(l, pack(l, 4294967296)));
+print_r(unpack(l, pack(l, -2147483648)));
+
+print_r(unpack(n, pack(n, 65534)));
+print_r(unpack(n, pack(n, 65537)));
+print_r(unpack(n, pack(n, 0)));
+print_r(unpack(n, pack(n, -1000)));
+print_r(unpack(n, pack(n, -64434)));
+print_r(unpack(n, pack(n, -65535)));
+
+print_r(unpack(s, pack(s, 32767)));
+print_r(unpack(s, pack(s, 65535)));
+print_r(unpack(s, pack(s, 0)));
+print_r(unpack(s, pack(s, -1000)));
+print_r(unpack(s, pack(s, -64434)));
+print_r(unpack(s, pack(s, -65535)));
+
+print_r(unpack(v, pack(v, 65534)));
+print_r(unpack(v, pack(v, 65537)));
+print_r(unpack(v, pack(v, 0)));
+print_r(unpack(v, pack(v, -1000)));
+print_r(unpack(v, pack(v, -64434)));
+print_r(unpack(v, pack(v, -65535)));
+?
+--EXPECT--
+Array
+(
+[1] = h
+)
+Array
+(
+[1] = hello world
+)
+hello
+Array
+(
+[1] = 129
+)
+Array
+(
+[1] = 127
+)
+Array
+(
+[1] = 255
+)
+Array
+(
+[1] = 127
+)
+Array
+(
+[1] = 4
+)
+Array
+(
+[1] = 65534
+)
+Array
+(
+[1] = 0
+)
+Array
+(
+[1] = -1000
+)
+Array
+(
+[1] = -64434
+)
+Array
+(
+[1] = 0
+)
+Array
+(
+[1] = -2147483648
+)
+Array
+(
+[1] = 65534
+)
+Array
+(
+[1] = 0
+)
+Array
+(
+[1] = -2147483646
+)
+Array
+(
+[1] = -1
+)
+Array
+(
+[1] = -2147483648
+)
+Array
+(
+[1] = 65534
+)
+Array
+(
+[1] = 0
+)
+Array
+(
+[1] = -2147483646
+)
+Array
+(
+[1] = 0
+)
+Array
+(
+[1] = -2147483648
+)
+Array
+(
+[1] = -3
+)
+Array
+(
+[1] = 65534
+)
+Array
+(
+[1] = 1
+)
+Array
+(
+[1] = 0
+)
+Array
+(
+[1] = 64536
+)
+Array
+(
+[1] = 1102
+)
+Array
+(
+[1] = 1
+)
+Array
+(
+[1] = 65534
+)
+Array
+(
+[1] = 0
+)
+Array
+(
+[1] = -2147483646
+)
+Array
+(
+[1] = 0
+)
+Array
+(
+[1] = -2147483648
+)
+Array
+(
+[1] = h
+)
+Array
+(
+[1] = hello world
+)
+Array
+(
+[1] = -127
+)
+Array
+(
+[1] = 127
+)
+Array
+(
+[1] = -1
+)
+Array
+(
+[1] = 127
+)
+Array
+(
+[1] = 3
+)
+Array
+(
+[1] = 65534
+)
+Array
+(
+[1] = 0
+)
+Array
+(
+[1] = -1000
+)
+Array
+(
+[1] = -64434
+)
+Array
+(
+[1] = -65535
+)
+Array
+(
+[1] = -2147483647
+)
+Array
+(
+[1] = 65534
+)
+Array
+(
+[1] = 0
+)
+Array
+(
+[1] = -2147483646
+)
+Array
+(
+[1] = 0
+)
+Array
+(
+[1] = -2147483648
+)
+Array
+(
+[1] = 65534
+)
+Array
+(

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/ftp/tests 001.phpt 002.phpt 003.phpt cert.pem server.inc skipif.inc

2006-11-19 Thread Nuno Lopes
nlopess Sun Nov 19 18:37:28 2006 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/ftp/tests  001.phpt 002.phpt 003.phpt cert.pem 
server.inc skipif.inc 
  Log:
  new tests. what a crazy idea...
  

http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/tests/001.phpt?view=markuprev=1.1
Index: php-src/ext/ftp/tests/001.phpt
+++ php-src/ext/ftp/tests/001.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/tests/002.phpt?view=markuprev=1.1
Index: php-src/ext/ftp/tests/002.phpt
+++ php-src/ext/ftp/tests/002.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/tests/003.phpt?view=markuprev=1.1
Index: php-src/ext/ftp/tests/003.phpt
+++ php-src/ext/ftp/tests/003.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/tests/cert.pem?view=markuprev=1.1
Index: php-src/ext/ftp/tests/cert.pem
+++ php-src/ext/ftp/tests/cert.pem

http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/tests/server.inc?view=markuprev=1.1
Index: php-src/ext/ftp/tests/server.inc
+++ php-src/ext/ftp/tests/server.inc

http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/tests/skipif.inc?view=markuprev=1.1
Index: php-src/ext/ftp/tests/skipif.inc
+++ php-src/ext/ftp/tests/skipif.inc

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



[PHP-CVS] cvs: php-src /ext/ftp/tests 001.phpt 002.phpt 003.phpt cert.pem server.inc skipif.inc

2006-11-19 Thread Nuno Lopes
nlopess Sun Nov 19 18:38:11 2006 UTC

  Modified files:  
/php-src/ext/ftp/tests  001.phpt 002.phpt 003.phpt cert.pem 
server.inc skipif.inc 
  Log:
  MFB
  http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/tests/001.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/ftp/tests/001.phpt
diff -u /dev/null php-src/ext/ftp/tests/001.phpt:1.2
--- /dev/null   Sun Nov 19 18:38:11 2006
+++ php-src/ext/ftp/tests/001.phpt  Sun Nov 19 18:38:11 2006
@@ -0,0 +1,36 @@
+--TEST--
+FTP login
+--SKIPIF--
+?php
+require 'skipif.inc';
+?
+--FILE--
+?php
+require 'server.inc';
+
+$ftp = ftp_connect('127.0.0.1', $port);
+if (!$ftp) die(Couldn't connect to the server);
+
+var_dump(ftp_login($ftp, 'user', 'pass'));
+var_dump(ftp_raw($ftp, 'HELP'));
+var_dump(ftp_raw($ftp, 'HELP HELP'));
+
+var_dump(ftp_close($ftp));
+?
+--EXPECT--
+bool(true)
+array(4) {
+  [0]=
+  string(55) 214-There is help available for the following commands:
+  [1]=
+  string(5)  USER
+  [2]=
+  string(5)  HELP
+  [3]=
+  string(15) 214 end of list
+}
+array(1) {
+  [0]=
+  string(39) 214 Syntax: HELP [SP string] CRLF
+}
+bool(true)
http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/tests/002.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/ftp/tests/002.phpt
diff -u /dev/null php-src/ext/ftp/tests/002.phpt:1.2
--- /dev/null   Sun Nov 19 18:38:11 2006
+++ php-src/ext/ftp/tests/002.phpt  Sun Nov 19 18:38:11 2006
@@ -0,0 +1,38 @@
+--TEST--
+FTP login (SSL)
+--SKIPIF--
+?php
+$ssl = 1;
+require 'skipif.inc';
+?
+--FILE--
+?php
+$ssl = 1;
+require 'server.inc';
+
+$ftp = ftp_ssl_connect('127.0.0.1', $port);
+if (!$ftp) die(Couldn't connect to the server);
+
+var_dump(ftp_login($ftp, 'user', 'pass'));
+var_dump(ftp_raw($ftp, 'HELP'));
+var_dump(ftp_raw($ftp, 'HELP HELP'));
+
+var_dump(ftp_close($ftp));
+?
+--EXPECT--
+bool(true)
+array(4) {
+  [0]=
+  string(55) 214-There is help available for the following commands:
+  [1]=
+  string(5)  USER
+  [2]=
+  string(5)  HELP
+  [3]=
+  string(15) 214 end of list
+}
+array(1) {
+  [0]=
+  string(39) 214 Syntax: HELP [SP string] CRLF
+}
+bool(true)
http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/tests/003.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/ftp/tests/003.phpt
diff -u /dev/null php-src/ext/ftp/tests/003.phpt:1.2
--- /dev/null   Sun Nov 19 18:38:11 2006
+++ php-src/ext/ftp/tests/003.phpt  Sun Nov 19 18:38:11 2006
@@ -0,0 +1,43 @@
+--TEST--
+FTP cwd
+--SKIPIF--
+?php
+require 'skipif.inc';
+?
+--FILE--
+?php
+require 'server.inc';
+
+$ftp = ftp_connect('127.0.0.1', $port);
+if (!$ftp) die(Couldn't connect to the server);
+
+var_dump(ftp_login($ftp, 'user', 'pass'));
+
+var_dump(ftp_pwd($ftp));
+
+var_dump(ftp_chdir($ftp, 'mydir'));
+var_dump(ftp_pwd($ftp));
+
+var_dump(ftp_chdir($ftp, '/xpto/mydir'));
+var_dump(ftp_pwd($ftp));
+
+var_dump(ftp_cdup($ftp));
+var_dump(ftp_pwd($ftp));
+
+var_dump(ftp_chdir($ftp, '..'));
+var_dump(ftp_pwd($ftp));
+
+var_dump(ftp_close($ftp));
+?
+--EXPECT--
+bool(true)
+string(1) /
+bool(true)
+string(6) /mydir
+bool(true)
+string(11) /xpto/mydir
+bool(true)
+string(5) /xpto
+bool(true)
+string(1) /
+bool(true)
http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/tests/cert.pem?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/ftp/tests/cert.pem
diff -u /dev/null php-src/ext/ftp/tests/cert.pem:1.2
--- /dev/null   Sun Nov 19 18:38:11 2006
+++ php-src/ext/ftp/tests/cert.pem  Sun Nov 19 18:38:11 2006
@@ -0,0 +1,48 @@
+-BEGIN CERTIFICATE REQUEST-
+MIIBmzCCAQQCAQAwWzELMAkGA1UEBhMCUFQxCzAJBgNVBAgTAkx4MQswCQYDVQQH
+EwJMeDEcMBoGA1UEChMTQSBtaW5oYSBlbXByZXNhLCBTQTEUMBIGA1UECxMLUEhQ
+IFFBIFRlYW0wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM9mfEOSYwXf58ch
+4NyO1QOU1XMfquz8OVpvMUITABLAevZpeQn6vZPHNyXHFQC0QC8scydK1rAYd2U+
+9K2aPub6ioMjYyjPpAE07l9EAAPUEBlqqsziB/wT8QjWkByyJEkYu+o0Wyjokhfn
+BMPvm52wLWUx9nvUeNDCftnKg1wxAgMBAAGgADANBgkqhkiG9w0BAQQFAAOBgQDD
+s1FeqPxnF2bWj8/dG8MyPaRfOAMVz1UsCZUciXIVG5LSIvR2qnMC3iEYt3s13sEq
+z8VJlNHa8nniE+VFNv093yIu+PlWXMEvb5y5EFqP2AYq3RAT+SJsSxGqIdzPZiKY
+INaktLCZmQ/E1v7/4hFzVRq9ydJI82DVS1nv282Whw==
+-END CERTIFICATE REQUEST-
+-BEGIN CERTIFICATE-
+MIIC4zCCAkygAwIBAgIBADANBgkqhkiG9w0BAQQFADBbMQswCQYDVQQGEwJQVDEL
+MAkGA1UECBMCTHgxCzAJBgNVBAcTAkx4MRwwGgYDVQQKExNBIG1pbmhhIGVtcHJl
+c2EsIFNBMRQwEgYDVQQLEwtQSFAgUUEgVGVhbTAeFw0wNjExMTkxODIzNTNaFw0w
+NzExMTkxODIzNTNaMFsxCzAJBgNVBAYTAlBUMQswCQYDVQQIEwJMeDELMAkGA1UE
+BxMCTHgxHDAaBgNVBAoTE0EgbWluaGEgZW1wcmVzYSwgU0ExFDASBgNVBAsTC1BI
+UCBRQSBUZWFtMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDPZnxDkmMF3+fH
+IeDcjtUDlNVzH6rs/DlabzFCEwASwHr2aXkJ+r2TxzclxxUAtEAvLHMnStawGHdl
+PvStmj7m+oqDI2Moz6QBNO5fRAAD1BAZaqrM4gf8E/EI1pAcsiRJGLvqNFso6JIX
+5wTD75udsC1lMfZ71HjQwn7ZyoNcMQIDAQABo4G2MIGzMB0GA1UdDgQWBBTIga5L
+q+Ub1SWXgNZRYCpq3c8Z+jCBgwYDVR0jBHwweoAUyIGuS6vlG9Ull4DWUWAqat3P
+GfqhX6RdMFsxCzAJBgNVBAYTAlBUMQswCQYDVQQIEwJMeDELMAkGA1UEBxMCTHgx
+HDAaBgNVBAoTE0EgbWluaGEgZW1wcmVzYSwgU0ExFDASBgNVBAsTC1BIUCBRQSBU
+ZWFtggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAe6AA8aC3KDI8