[PHP-CVS] cvs: php4 / run-tests.php

2002-10-13 Thread Derick Rethans

derick  Mon Oct 14 03:18:24 2002 EDT

  Modified files:  
/php4   run-tests.php 
  Log:
  - Added the TEST_PHP_USER environment variable with which you can specify
additional directories with tests to run. This is ideal for having your own
test suite on your system. You can specify more directories by seperating them
with a ",", for example:
  
TEST_PHP_USER=/dat/dev/xdebug/tests,/dat/dev/srm/tests make test
  
  
Index: php4/run-tests.php
diff -u php4/run-tests.php:1.69 php4/run-tests.php:1.70
--- php4/run-tests.php:1.69 Sat Oct 12 15:29:56 2002
+++ php4/run-tests.php  Mon Oct 14 03:18:23 2002
@@ -77,13 +77,19 @@
 }
 
 // Check whether a detailed log is wanted.
-
 if (getenv('TEST_PHP_DETAILED')) {
define('DETAILED', getenv('TEST_PHP_DETAILED'));
 } else {
define('DETAILED', 0);
 }
 
+// Check whether user test dirs are requested.
+if (getenv('TEST_PHP_USER')) {
+   $user_tests = explode (',', getenv('TEST_PHP_USER'));
+} else {
+   $user_tests = NULL;
+}
+
 // Write test context information.
 
 echo "
@@ -95,6 +101,11 @@
 PHP_OS  : " . PHP_OS . "
 INI actual  : " . realpath(get_cfg_var('cfg_file_path')) . "
 More .INIs  : " . str_replace("\n","", php_ini_scanned_files()) . "
+Extra dirs  : ";
+foreach ($user_tests as $test_dir) {
+   echo "{$test_dir}\n  ";
+}
+echo "
 =
 ";
 
@@ -138,6 +149,10 @@
 
 foreach ($test_dirs as $dir) {
find_files("{$cwd}/{$dir}", ($dir == 'ext'));
+}
+
+foreach ($user_tests as $dir) {
+   find_files("{$dir}", ($dir == 'ext'));
 }
 
 function find_files($dir,$is_ext_dir=FALSE,$ignore=FALSE)



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




[PHP-CVS] cvs: php4 /sapi/cli php_cli.c

2002-10-13 Thread Derick Rethans

derick  Mon Oct 14 02:58:57 2002 EDT

  Modified files:  
/php4/sapi/cli  php_cli.c 
  Log:
  - Fix CLI
  
  
Index: php4/sapi/cli/php_cli.c
diff -u php4/sapi/cli/php_cli.c:1.35 php4/sapi/cli/php_cli.c:1.36
--- php4/sapi/cli/php_cli.c:1.35Thu Oct  3 06:35:33 2002
+++ php4/sapi/cli/php_cli.c Mon Oct 14 02:58:57 2002
@@ -156,7 +156,7 @@
/* In CGI mode, we consider the environment to be a part of the server
 * variables
 */
-   php_import_environment_variables(track_vars_array TSRMLS_CC);
+   _php_import_environment_variables(track_vars_array TSRMLS_CC);
 
/* Build the special-case PHP_SELF variable for the CLI version */
php_register_variable("PHP_SELF", php_self, track_vars_array TSRMLS_CC);



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




[PHP-CVS] cvs: php4 /main php_network.h

2002-10-13 Thread Sebastian Bergmann

sebastian   Mon Oct 14 01:56:03 2002 EDT

  Modified files:  
/php4/main  php_network.h 
  Log:
  Whitespace fixes.
  
  
Index: php4/main/php_network.h
diff -u php4/main/php_network.h:1.34 php4/main/php_network.h:1.35
--- php4/main/php_network.h:1.34Mon Oct 14 01:54:15 2002
+++ php4/main/php_network.h Mon Oct 14 01:56:03 2002
@@ -15,21 +15,21 @@
| Author: Stig Venaas <[EMAIL PROTECTED]>  |
+--+
  */
-/* $Id: php_network.h,v 1.34 2002/10/14 05:54:15 sebastian Exp $ */
+/* $Id: php_network.h,v 1.35 2002/10/14 05:56:03 sebastian Exp $ */
 
 #ifndef _PHP_NETWORK_H
 #define _PHP_NETWORK_H
 
 #ifdef PHP_WIN32
-# ifndef WINNT
-#  define WINNT 1
-# endif
-# undef FD_SETSIZE
-# include "arpa/inet.h"
-# define socklen_t unsigned int
+#ifndef WINNT
+#define WINNT 1
+#endif
+#undef FD_SETSIZE
+#include "arpa/inet.h"
+#define socklen_t unsigned int
 #else
-# undef closesocket
-# define closesocket close
+#undef closesocket
+#define closesocket close
 #endif
 
 #ifndef HAVE_SHUTDOWN
@@ -55,7 +55,7 @@
 PHPAPI char *php_socket_strerror(long err, char *buf, size_t bufsize);
 
 #ifdef HAVE_NETINET_IN_H
-# include 
+#include 
 #endif
 
 #ifdef HAVE_SYS_SOCKET_H
@@ -65,9 +65,9 @@
 /* These are here, rather than with the win32 counterparts above,
  * since  defines them. */
 #ifndef SHUT_RD
-# define SHUT_RD 0
-# define SHUT_WR 1
-# define SHUT_RDWR 2
+#define SHUT_RD 0
+#define SHUT_WR 1
+#define SHUT_RDWR 2
 #endif
 
 #ifdef HAVE_SYS_TIME_H
@@ -83,13 +83,13 @@
 #endif
 
 #ifdef PHP_WIN32
-# define SOCK_ERR INVALID_SOCKET
-# define SOCK_CONN_ERR SOCKET_ERROR
-# define SOCK_RECV_ERR SOCKET_ERROR
+#define SOCK_ERR INVALID_SOCKET
+#define SOCK_CONN_ERR SOCKET_ERROR
+#define SOCK_RECV_ERR SOCKET_ERROR
 #else
-# define SOCK_ERR -1
-# define SOCK_CONN_ERR -1
-# define SOCK_RECV_ERR -1
+#define SOCK_ERR -1
+#define SOCK_CONN_ERR -1
+#define SOCK_RECV_ERR -1
 #endif
 
 #define PHP_SOCK_CHUNK_SIZE8192



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




[PHP-CVS] cvs: php4 /main php_network.h

2002-10-13 Thread Sebastian Bergmann

sebastian   Mon Oct 14 01:54:15 2002 EDT

  Modified files:  
/php4/main  php_network.h 
  Log:
  Fix Win32 build.
  
  
Index: php4/main/php_network.h
diff -u php4/main/php_network.h:1.33 php4/main/php_network.h:1.34
--- php4/main/php_network.h:1.33Sun Oct 13 19:43:21 2002
+++ php4/main/php_network.h Mon Oct 14 01:54:15 2002
@@ -15,7 +15,7 @@
| Author: Stig Venaas <[EMAIL PROTECTED]>  |
+--+
  */
-/* $Id: php_network.h,v 1.33 2002/10/13 23:43:21 wez Exp $ */
+/* $Id: php_network.h,v 1.34 2002/10/14 05:54:15 sebastian Exp $ */
 
 #ifndef _PHP_NETWORK_H
 #define _PHP_NETWORK_H
@@ -27,9 +27,6 @@
 # undef FD_SETSIZE
 # include "arpa/inet.h"
 # define socklen_t unsigned int
-# define SHUT_RD   SD_RECEIVE
-# define SHUT_WR   SD_SEND
-# define SHUT_RDWR SD_BOTH
 #else
 # undef closesocket
 # define closesocket close



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




[PHP-CVS] cvs: php4 /main streams.c

2002-10-13 Thread Wez Furlong

wez Mon Oct 14 01:38:50 2002 EDT

  Modified files:  
/php4/main  streams.c 
  Log:
  *cough*
  Fix inverted logic for the assert.
  
  
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.104 php4/main/streams.c:1.105
--- php4/main/streams.c:1.104   Sun Oct 13 22:28:35 2002
+++ php4/main/streams.c Mon Oct 14 01:38:50 2002
@@ -20,7 +20,7 @@
+--+
  */
 
-/* $Id: streams.c,v 1.104 2002/10/14 02:28:35 wez Exp $ */
+/* $Id: streams.c,v 1.105 2002/10/14 05:38:50 wez Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -760,8 +760,9 @@
}

if (total_copied == 0) {
-   if (grow_mode)
-   assert(bufstart != NULL);
+   if (grow_mode) {
+   assert(bufstart == NULL);
+   }
return NULL;
}




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




[PHP-CVS] cvs: php4 /ext/snmp snmp.c

2002-10-13 Thread Jani Taskinen

sniper  Sun Oct 13 22:46:52 2002 EDT

  Modified files:  
/php4/ext/snmp  snmp.c 
  Log:
  This is not zval..
  
  
Index: php4/ext/snmp/snmp.c
diff -u php4/ext/snmp/snmp.c:1.60 php4/ext/snmp/snmp.c:1.61
--- php4/ext/snmp/snmp.c:1.60   Thu Sep  5 07:50:43 2002
+++ php4/ext/snmp/snmp.cSun Oct 13 22:46:52 2002
@@ -17,7 +17,7 @@
 |  Steven Lawrance <[EMAIL PROTECTED]>|
 +--+
 */
-/* $Id: snmp.c,v 1.60 2002/09/05 11:50:43 hyanantha Exp $ */
+/* $Id: snmp.c,v 1.61 2002/10/14 02:46:52 sniper Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -341,8 +341,8 @@

add_assoc_string(return_value,buf2,buf,1);
}
if (st >= 2 && st != 11) {
-   if (Z_TYPE_P(vars) != 
SNMP_ENDOFMIBVIEW && 
-   Z_TYPE_P(vars) != 
SNMP_NOSUCHOBJECT && Z_TYPE_P(vars) != SNMP_NOSUCHINSTANCE) {
+   if (vars->type != SNMP_ENDOFMIBVIEW && 
+   vars->type != 
+SNMP_NOSUCHOBJECT && vars->type != SNMP_NOSUCHINSTANCE) {
memmove((char *)name, (char 
*)vars->name,vars->name_length * sizeof(oid));
name_length = 
vars->name_length;
keepwalking = 1;



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




[PHP-CVS] cvs: php4 /ext/standard file.c /main streams.c

2002-10-13 Thread Wez Furlong

wez Sun Oct 13 22:28:36 2002 EDT

  Modified files:  
/php4/ext/standard  file.c 
/php4/main  streams.c 
  Log:
  @- fgets($fp) (with no length parameter) now uses a buffer as long as the
  @  the next line available from the $fp. Previously, there was a 1KB limit.
  @  (Wez)
  
  
Index: php4/ext/standard/file.c
diff -u php4/ext/standard/file.c:1.268 php4/ext/standard/file.c:1.269
--- php4/ext/standard/file.c:1.268  Sat Oct  5 06:59:35 2002
+++ php4/ext/standard/file.cSun Oct 13 22:28:35 2002
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.268 2002/10/05 10:59:35 wez Exp $ */
+/* $Id: file.c,v 1.269 2002/10/14 02:28:35 wez Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -1247,8 +1247,8 @@
 PHPAPI PHP_FUNCTION(fgets)
 {
zval **arg1, **arg2;
-   int len = 1024;
-   char *buf;
+   int len;
+   char *buf = NULL;
int argc = ZEND_NUM_ARGS();
php_stream *stream;
 
@@ -1258,30 +1258,33 @@
 
php_stream_from_zval(stream, arg1);
 
-   if (argc>1) {
+   if (argc == 1) {
+   /* ask streams to give us a buffer of an appropriate size */
+   buf = php_stream_gets(stream, NULL, 0);
+   if (buf == NULL)
+   goto exit_failed;
+   } else if (argc > 1) {
convert_to_long_ex(arg2);
len = Z_LVAL_PP(arg2);
-   }
-
-   if (len < 0) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter may not 
be negative");
-   RETURN_FALSE;
-   }
-
-   buf = emalloc(sizeof(char) * (len + 1));
-   /* needed because recv doesnt put a null at the end*/
-   memset(buf, 0, len+1);
 
-   if (php_stream_gets(stream, buf, len) == NULL)
-   goto exit_failed;
+   if (len < 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter 
+may not be negative");
+   RETURN_FALSE;
+   }
 
+   buf = ecalloc(len + 1, sizeof(char));
+   if (php_stream_gets(stream, buf, len) == NULL)
+   goto exit_failed;
+   }
+   
if (PG(magic_quotes_runtime)) {
Z_STRVAL_P(return_value) = php_addslashes(buf, 0, 
&Z_STRLEN_P(return_value), 1 TSRMLS_CC);
Z_TYPE_P(return_value) = IS_STRING;
} else {
ZVAL_STRING(return_value, buf, 0);
-   /* resize buffer if it's much larger than the result */
-   if (Z_STRLEN_P(return_value) < len / 2) {
+   /* resize buffer if it's much larger than the result.
+* Only needed if the user requested a buffer size. */
+   if (argc > 1 && Z_STRLEN_P(return_value) < len / 2) {
Z_STRVAL_P(return_value) = erealloc(buf, 
Z_STRLEN_P(return_value) + 1);
}
}
@@ -1289,7 +1292,8 @@
 
 exit_failed:
RETVAL_FALSE;
-   efree(buf);
+   if (buf)
+   efree(buf);
 }
 /* }}} */
 
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.103 php4/main/streams.c:1.104
--- php4/main/streams.c:1.103   Sun Oct 13 19:43:46 2002
+++ php4/main/streams.c Sun Oct 13 22:28:35 2002
@@ -20,7 +20,7 @@
+--+
  */
 
-/* $Id: streams.c,v 1.103 2002/10/13 23:43:46 wez Exp $ */
+/* $Id: streams.c,v 1.104 2002/10/14 02:28:35 wez Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -666,8 +666,8 @@
 PHPAPI char *_php_stream_gets(php_stream *stream, char *buf, size_t maxlen TSRMLS_DC)
 {
size_t avail = 0;
-   int did_copy = 0;
size_t current_buf_size = 0;
+   size_t total_copied = 0;
int grow_mode = 0;
char *bufstart = buf;
 
@@ -718,6 +718,7 @@
 * hard to follow */
bufstart = erealloc(bufstart, current_buf_size + cpysz 
+ 1);
current_buf_size += cpysz + 1;
+   buf = bufstart + total_copied;
} else {
if (cpysz >= maxlen - 1) {
cpysz = maxlen - 1;
@@ -731,8 +732,8 @@
stream->readpos += cpysz;
buf += cpysz;
maxlen -= cpysz;
+   total_copied += cpysz;
 
-   did_copy = 1;
if (done) {
break;
}
@@ -758,8 +759,11 @@
}
}

-   if (!did_copy)
+   if (total_copied == 0) {
+   if (grow_mode)
+   assert(bufstart != NULL);
return NULL;
+   }

buf[0] = '\0';
 



-- 
PHP CVS Mailing List (http://www.php.n

[PHP-CVS] cvs: php4 /ext/standard/tests/file userstreams.phpt

2002-10-13 Thread Wez Furlong

wez Sun Oct 13 22:25:52 2002 EDT

  Modified files:  
/php4/ext/standard/tests/file   userstreams.phpt 
  Log:
  Add a sanity check and more verbose output in the case of an error.
  
  
Index: php4/ext/standard/tests/file/userstreams.phpt
diff -u php4/ext/standard/tests/file/userstreams.phpt:1.4 
php4/ext/standard/tests/file/userstreams.phpt:1.5
--- php4/ext/standard/tests/file/userstreams.phpt:1.4   Sat Oct  5 06:35:13 2002
+++ php4/ext/standard/tests/file/userstreams.phpt   Sun Oct 13 22:25:51 2002
@@ -269,15 +269,21 @@
 }
 
 $fail_count = 0;
+
 fseek($fp, $DATALEN / 2, SEEK_SET);
 fseek($tf, $DATALEN / 2, SEEK_SET);
 
+if (ftell($fp) != ftell($tf)) {
+   echo "SEEK: positions do not match!\n";
+}
+
+$n = 0;
 while(!feof($fp)) {
$uline = fgets($fp, 1024);
$rline = fgets($tf, 1024);
 
if ($uline != $rline) {
-   echo "FGETS: FAIL\nuser=$uline\nreal=$rline\n";
+   echo "FGETS: FAIL\niter=$n user=$uline [pos=" . ftell($fp) . 
+"]\nreal=$rline [pos=" . ftell($tf) . "]\n";
$fail_count++;
break;
}



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




[PHP-CVS] cvs: php4 /main network.c

2002-10-13 Thread Wez Furlong

wez Sun Oct 13 21:27:43 2002 EDT

  Modified files:  
/php4/main  network.c 
  Log:
  Implement better SSL error handling.
  
  
Index: php4/main/network.c
diff -u php4/main/network.c:1.77 php4/main/network.c:1.78
--- php4/main/network.c:1.77Sun Oct 13 19:43:21 2002
+++ php4/main/network.c Sun Oct 13 21:27:43 2002
@@ -16,7 +16,7 @@
| Streams work by Wez Furlong <[EMAIL PROTECTED]>   |
+--+
  */
-/* $Id: network.c,v 1.77 2002/10/13 23:43:21 wez Exp $ */
+/* $Id: network.c,v 1.78 2002/10/14 01:27:43 wez Exp $ */
 
 /*#define DEBUG_MAIN_NETWORK 1*/
 
@@ -746,6 +746,84 @@
   return ret;
 }
 
+#if HAVE_OPENSSL_EXT
+static int handle_ssl_error(php_stream *stream, int nr_bytes TSRMLS_DC)
+{
+   php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract;
+   int err = SSL_get_error(sock->ssl_handle, nr_bytes);
+   char esbuf[512];
+   char *ebuf = NULL, *wptr = NULL;
+   size_t ebuf_size = 0;
+   unsigned long code;
+   int retry = 1;
+
+   switch(err) {
+   case SSL_ERROR_ZERO_RETURN:
+   /* SSL terminated (but socket may still be active) */
+   retry = 0;
+   break;
+   case SSL_ERROR_WANT_READ:
+   case SSL_ERROR_WANT_WRITE:
+   /* re-negotiation, or perhaps the SSL layer needs more
+* packets: retry in next iteration */
+   break;
+   case SSL_ERROR_SYSCALL:
+   if (ERR_peek_error() == 0) {
+   if (nr_bytes == 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING,
+   "SSL: fatal protocol error");
+   stream->eof = 1;
+   retry = 0;
+   } else {
+   char *estr = 
+php_socket_strerror(php_socket_errno(), NULL, 0);
+
+   php_error_docref(NULL TSRMLS_CC, E_WARNING,
+   "SSL: %s", estr);
+
+   efree(estr);
+   retry = 0;
+   }
+   break;
+   }
+   /* fall through */
+   default:
+   /* some other error */
+   while ((code = ERR_get_error()) != 0) {
+   /* allow room for a NUL and an optional \n */
+   if (ebuf) {
+   esbuf[0] = '\n';
+   esbuf[1] = '\0';
+   ERR_error_string_n(code, esbuf + 1, 
+sizeof(esbuf) - 2);
+   } else {
+   esbuf[0] = '\0';
+   ERR_error_string_n(code, esbuf, sizeof(esbuf) 
+- 1);
+   }
+   code = strlen(esbuf);
+   esbuf[code] = '\0';
+
+   ebuf = erealloc(ebuf, ebuf_size + code + 1);
+   if (wptr = NULL)
+   wptr = ebuf;
+
+   /* also copies the NUL */
+   memcpy(wptr, esbuf, code + 1);
+   wptr += code;
+   }
+
+   php_error_docref(NULL TSRMLS_CC, E_WARNING,
+   "SSL operation failed with code %d.%s%s",
+   err,
+   ebuf ? "OpenSSL Error messages:\n" : "",
+   ebuf ? ebuf : "");
+   
+   retry = 0;
+   }
+   return retry;
+}
+#endif
+
+
+
 static size_t php_sockop_write(php_stream *stream, const char *buf, size_t count 
TSRMLS_DC)
 {
php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract;
@@ -753,7 +831,18 @@

 #if HAVE_OPENSSL_EXT
if (sock->ssl_active) {
-   didwrite = SSL_write(sock->ssl_handle, buf, count);
+   int retry = 1;
+
+   do {
+   didwrite = SSL_write(sock->ssl_handle, buf, count);
+
+   if (didwrite <= 0) {
+   retry = handle_ssl_error(stream, didwrite TSRMLS_CC);
+   } else {
+   break;
+   }
+   } while(retry);
+   
} else
 #endif
{
@@ -768,7 +857,8 @@
}
   

[PHP-CVS] cvs: php4 /main user_streams.c

2002-10-13 Thread Wez Furlong

wez Sun Oct 13 20:16:02 2002 EDT

  Modified files:  
/php4/main  user_streams.c 
  Log:
  Fix stream_eof result interpretation (and thus the user-streams test).
  
  
Index: php4/main/user_streams.c
diff -u php4/main/user_streams.c:1.26 php4/main/user_streams.c:1.27
--- php4/main/user_streams.c:1.26   Sat Oct  5 06:35:13 2002
+++ php4/main/user_streams.cSun Oct 13 20:16:02 2002
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: user_streams.c,v 1.26 2002/10/05 10:35:13 wez Exp $ */
+/* $Id: user_streams.c,v 1.27 2002/10/14 00:16:02 wez Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -477,11 +477,12 @@
&retval,
0, NULL, 0, NULL TSRMLS_CC);
 
-   if (!(call_result == SUCCESS && retval != NULL && zval_is_true(retval))) {
-   if (call_result == FAILURE) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" 
USERSTREAM_EOF " is not implemented! Assuming EOF",
-   us->wrapper->classname);
-   }
+   if (call_result == SUCCESS && retval != NULL && zval_is_true(retval)) {
+   stream->eof = 1;
+   } else if (call_result == FAILURE) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING,
+   "%s::" USERSTREAM_EOF " is not implemented! Assuming 
+EOF",
+   us->wrapper->classname);
 
stream->eof = 1;
}



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




[PHP-CVS] cvs: php4 /main streams.c

2002-10-13 Thread Wez Furlong

wez Sun Oct 13 19:43:46 2002 EDT

  Modified files:  
/php4/main  streams.c 
  Log:
  Remove some old code.
  
  
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.102 php4/main/streams.c:1.103
--- php4/main/streams.c:1.102   Sun Oct 13 18:52:33 2002
+++ php4/main/streams.c Sun Oct 13 19:43:46 2002
@@ -20,7 +20,7 @@
+--+
  */
 
-/* $Id: streams.c,v 1.102 2002/10/13 22:52:33 wez Exp $ */
+/* $Id: streams.c,v 1.103 2002/10/13 23:43:46 wez Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -544,7 +544,7 @@
if (toread > size)
toread = size;
 
-   if (toread) {
+   if (toread > 0) {
memcpy(buf, stream->readbuf + stream->readpos, toread);
stream->readpos += toread;
}
@@ -572,14 +572,6 @@
return 0;
 
return stream->eof;
-   
-   /* we define our stream reading function so that it
-  must return EOF when an EOF condition occurs, when
-  working in unbuffered mode and called with these args */
-   if (stream->filterhead)
-   return stream->filterhead->fops->eof(stream, stream->filterhead 
TSRMLS_CC);
-   
-   return stream->ops->read(stream, NULL, 0 TSRMLS_CC) == EOF ? 1 : 0;
 }
 
 PHPAPI int _php_stream_putc(php_stream *stream, int c TSRMLS_DC)



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




[PHP-CVS] cvs: php4 /main network.c php_network.h

2002-10-13 Thread Wez Furlong

wez Sun Oct 13 19:43:21 2002 EDT

  Modified files:  
/php4/main  network.c php_network.h 
  Log:
  A much better probable fix for #16114.
  
  
Index: php4/main/network.c
diff -u php4/main/network.c:1.76 php4/main/network.c:1.77
--- php4/main/network.c:1.76Sun Oct 13 19:21:05 2002
+++ php4/main/network.c Sun Oct 13 19:43:21 2002
@@ -16,7 +16,7 @@
| Streams work by Wez Furlong <[EMAIL PROTECTED]>   |
+--+
  */
-/* $Id: network.c,v 1.76 2002/10/13 23:21:05 wez Exp $ */
+/* $Id: network.c,v 1.77 2002/10/13 23:43:21 wez Exp $ */
 
 /*#define DEBUG_MAIN_NETWORK 1*/
 
@@ -849,6 +849,8 @@
 static int php_sockop_close(php_stream *stream, int close_handle TSRMLS_DC)
 {
php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract;
+   fd_set wrfds, efds;
+   int n;
 
if (close_handle) {
 #if HAVE_OPENSSL_EXT
@@ -862,7 +864,18 @@
}
 #endif
 
-   /* shutdown(sock->socket, 0); */
+   /* prevent more data from coming in */
+   shutdown(sock->socket, SHUT_RD);
+
+   /* make sure that the OS sends all data before we close the connection 
+*/
+   do {
+   FD_ZERO(&wrfds);
+   FD_SET(sock->socket, &wrfds);
+   efds = wrfds;
+   
+   n = select(sock->socket + 1, NULL, &wrfds, &efds, NULL);
+   } while (n == -1 && php_socket_errno() == EINTR);
+   
closesocket(sock->socket);
 
}
Index: php4/main/php_network.h
diff -u php4/main/php_network.h:1.32 php4/main/php_network.h:1.33
--- php4/main/php_network.h:1.32Sun Oct 13 18:01:40 2002
+++ php4/main/php_network.h Sun Oct 13 19:43:21 2002
@@ -15,7 +15,7 @@
| Author: Stig Venaas <[EMAIL PROTECTED]>  |
+--+
  */
-/* $Id: php_network.h,v 1.32 2002/10/13 22:01:40 wez Exp $ */
+/* $Id: php_network.h,v 1.33 2002/10/13 23:43:21 wez Exp $ */
 
 #ifndef _PHP_NETWORK_H
 #define _PHP_NETWORK_H
@@ -27,6 +27,9 @@
 # undef FD_SETSIZE
 # include "arpa/inet.h"
 # define socklen_t unsigned int
+# define SHUT_RD   SD_RECEIVE
+# define SHUT_WR   SD_SEND
+# define SHUT_RDWR SD_BOTH
 #else
 # undef closesocket
 # define closesocket close
@@ -60,6 +63,14 @@
 
 #ifdef HAVE_SYS_SOCKET_H
 #include 
+#endif
+
+/* These are here, rather than with the win32 counterparts above,
+ * since  defines them. */
+#ifndef SHUT_RD
+# define SHUT_RD 0
+# define SHUT_WR 1
+# define SHUT_RDWR 2
 #endif
 
 #ifdef HAVE_SYS_TIME_H



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




[PHP-CVS] cvs: php4 /main network.c

2002-10-13 Thread Wez Furlong

wez Sun Oct 13 19:21:06 2002 EDT

  Modified files:  
/php4/main  network.c 
  Log:
  Probable fix for #16114
  
  
Index: php4/main/network.c
diff -u php4/main/network.c:1.75 php4/main/network.c:1.76
--- php4/main/network.c:1.75Sun Oct 13 18:01:39 2002
+++ php4/main/network.c Sun Oct 13 19:21:05 2002
@@ -16,7 +16,7 @@
| Streams work by Wez Furlong <[EMAIL PROTECTED]>   |
+--+
  */
-/* $Id: network.c,v 1.75 2002/10/13 22:01:39 wez Exp $ */
+/* $Id: network.c,v 1.76 2002/10/13 23:21:05 wez Exp $ */
 
 /*#define DEBUG_MAIN_NETWORK 1*/
 
@@ -862,7 +862,7 @@
}
 #endif
 
-   shutdown(sock->socket, 0);
+   /* shutdown(sock->socket, 0); */
closesocket(sock->socket);
 
}



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




[PHP-CVS] cvs: php4 /main streams.c

2002-10-13 Thread Wez Furlong

wez Sun Oct 13 18:52:33 2002 EDT

  Modified files:  
/php4/main  streams.c 
  Log:
  Fix a nasty nasty bug:
  When not enough data to satisfy a read was found in the buffer, fgets modifies
  the buf pointer to point to the position to store the next chunk.  It then
  returned the modified buf pointer, instead of a pointer to the start of the
  buffer.
  
  Also added some infrastructure for making fgets grow the buffer on-demand to
  the correct line-size.  Since streams uses reasonable chunk sizes, the
  performance of the realloc's should be pretty good; in the best case, the line
  is already found completely in the buffer, so the returned buffer will be
  allocated to precisely the correct size.
  
  In the worst case, where the buffer only contains part of the line, we get a
  realloc per buffer fill. The reallocs are either the size of the remainder
  of the line, or the chunk_size (if the buffer sill does not contain a complete
  line).  Each realloc adds an extra byte for a NUL terminator.
  
  I think this will perform quite well using the default chunk size of 8K.
  
  
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.101 php4/main/streams.c:1.102
--- php4/main/streams.c:1.101   Fri Oct 11 22:56:34 2002
+++ php4/main/streams.c Sun Oct 13 18:52:33 2002
@@ -20,7 +20,7 @@
+--+
  */
 
-/* $Id: streams.c,v 1.101 2002/10/12 02:56:34 wez Exp $ */
+/* $Id: streams.c,v 1.102 2002/10/13 22:52:33 wez Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -668,12 +668,20 @@
return eol;
 }
 
+/* If buf == NULL, the buffer will be allocated automatically and will be of an
+ * appropriate length to hold the line, regardless of the line length, memory
+ * permitting */
 PHPAPI char *_php_stream_gets(php_stream *stream, char *buf, size_t maxlen TSRMLS_DC)
 {
size_t avail = 0;
int did_copy = 0;
-
-   if (maxlen == 0)
+   size_t current_buf_size = 0;
+   int grow_mode = 0;
+   char *bufstart = buf;
+
+   if (buf == NULL)
+   grow_mode = 1;
+   else if (maxlen == 0)
return NULL;
 
/*
@@ -708,9 +716,21 @@
cpysz = avail;
}
 
-   if (cpysz >= maxlen - 1) {
-   cpysz = maxlen - 1;
-   done = 1;
+   if (grow_mode) {
+   /* allow room for a NUL. If this realloc is really a 
+realloc
+* (ie: second time around), we get an extra byte. In 
+most
+* cases, with the default chunk size of 8K, we will 
+only
+* incur that overhead once.  When people have lines 
+longer
+* than 8K, we waste 1 byte per additional 8K or so.
+* That seems acceptable to me, to avoid making this 
+code
+* hard to follow */
+   bufstart = erealloc(bufstart, current_buf_size + cpysz 
++ 1);
+   current_buf_size += cpysz + 1;
+   } else {
+   if (cpysz >= maxlen - 1) {
+   cpysz = maxlen - 1;
+   done = 1;
+   }
}
 
memcpy(buf, readptr, cpysz);
@@ -728,9 +748,15 @@
break;
} else {
/* XXX: Should be fine to always read chunk_size */
-   size_t toread = maxlen - 1;
-   if (toread > stream->chunk_size)
+   size_t toread;
+   
+   if (grow_mode) {
toread = stream->chunk_size;
+   } else {
+   toread = maxlen - 1;
+   if (toread > stream->chunk_size)
+   toread = stream->chunk_size;
+   }
 
php_stream_fill_read_buffer(stream, toread TSRMLS_CC);
 
@@ -745,7 +771,7 @@

buf[0] = '\0';
 
-   return buf;
+   return bufstart;
 }
 
 PHPAPI int _php_stream_flush(php_stream *stream, int closing TSRMLS_DC)



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




[PHP-CVS] cvs: php4 /ext/standard fsock.c /main network.c php_network.h

2002-10-13 Thread Wez Furlong

wez Sun Oct 13 18:01:40 2002 EDT

  Modified files:  
/php4/ext/standard  fsock.c 
/php4/main  network.c php_network.h 
  Log:
  (php_socket_errno) win32 errno compatible macro.
  (php_socket_strerror) win32 compatible strerror replacement.
  Add an E_NOTICE when a socket write fails.
  
  
Index: php4/ext/standard/fsock.c
diff -u php4/ext/standard/fsock.c:1.104 php4/ext/standard/fsock.c:1.105
--- php4/ext/standard/fsock.c:1.104 Wed Sep 25 11:25:11 2002
+++ php4/ext/standard/fsock.c   Sun Oct 13 18:01:39 2002
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: fsock.c,v 1.104 2002/09/25 15:25:11 wez Exp $ */
+/* $Id: fsock.c,v 1.105 2002/10/13 22:01:39 wez Exp $ */
 
 /* converted to PHP Streams and moved much code to main/network.c [wez] */
 
@@ -113,6 +113,7 @@
 
 /*
  * Converts a host name to an IP address.
+ * TODO: This looks like unused code suitable for nuking.
  */
 PHPAPI int php_lookup_hostname(const char *addr, struct in_addr *in)
 {
@@ -144,13 +145,11 @@
struct timeval tv;
char *hashkey = NULL;
php_stream *stream = NULL;
-#ifdef PHP_WIN32
int err;
-#endif
 
RETVAL_FALSE;

-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lzzd", &host, 
&host_len, &port, &zerrno, &zerrstr, &timeout) == FAILURE){
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lzzd", &host, 
+&host_len, &port, &zerrno, &zerrstr, &timeout) == FAILURE) {
RETURN_FALSE;
}
 
@@ -204,8 +203,8 @@
int socktype = SOCK_STREAM;
int i;
 
-   for (i = 0; sockmodes[i].proto != NULL; i++){
-   if (strncmp(host, sockmodes[i].proto, sockmodes[i].protolen) 
== 0)  {
+   for (i = 0; sockmodes[i].proto != NULL; i++) {
+   if (strncmp(host, sockmodes[i].proto, sockmodes[i].protolen) 
+== 0) {
ssl_flags = sockmodes[i].ssl_flags; 
socktype = sockmodes[i].socktype;
host += sockmodes[i].protolen;
@@ -213,24 +212,22 @@
}
}
 #if !HAVE_OPENSSL_EXT
-   if (ssl_flags != php_ssl_none)  {
+   if (ssl_flags != php_ssl_none) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "no SSL support in 
this build");
}
else
 #endif
stream = php_stream_sock_open_host(host, (unsigned short)port, 
socktype, &tv, hashkey);
 
-#ifdef PHP_WIN32
/* Preserve error */
-   err = WSAGetLastError();
-#endif
+   err = php_socket_errno();
 
if (stream == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect 
to %s:%d", host, port);
}

 #if HAVE_OPENSSL_EXT
-   if (stream && ssl_flags != php_ssl_none){
+   if (stream && ssl_flags != php_ssl_none) {
int ssl_ret = FAILURE;
switch(ssl_flags)   {
case php_ssl_v23:
@@ -248,8 +245,11 @@
}
 #endif

-   } else  
+   } else {
+   /* FIXME: Win32 - this probably does not return sensible errno and 
+errstr */
stream = php_stream_sock_open_unix(host, host_len, hashkey, &tv);
+   err = php_socket_errno();
+   }
 
if (hashkey)
efree(hashkey);
@@ -257,30 +257,14 @@
if (stream == NULL) {
if (zerrno) {
zval_dtor(zerrno);
-#ifndef PHP_WIN32
-   ZVAL_LONG(zerrno, errno);
-#else
ZVAL_LONG(zerrno, err);
-#endif
}
-#ifndef PHP_WIN32
if (zerrstr) {
-   zval_dtor(zerrstr);
-   ZVAL_STRING(zerrstr, strerror(errno), 1);
-   }
-#else
-   if (zerrstr) {
-   char *buf;
+   char *buf = php_socket_strerror(err, NULL, 0);
 
-   if (! FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, 
-   Z_LVAL_P(zerrno), MAKELANGID(LANG_NEUTRAL, 
SUBLANG_DEFAULT), (LPTSTR)&buf, 0, NULL)) {
-   RETURN_FALSE;
-   }
-
-   ZVAL_STRING(zerrstr, buf, 1);
-   LocalFree(buf);
+   /* no need to dup; we would only need to efree buf anyway */
+   ZVAL_STRING(zerrstr, buf, 0);
}
-#endif
RETURN_FALSE;
}

Index: php4/main/network.c
diff -u php4/main/network.c:1.74 php4/main/network.c:1.7

Re: [PHP-CVS] Re: cvs: php4 /main php_variables.c php_variables.h

2002-10-13 Thread Shane Caraveo

Essentialy the same thing is done in zend engine with zend_error_cb, and
this is nothing fancy, but the one thing I can think of might be the 3rd
line I added in php_variables.c.  Maybe this needs to happen within one
of the startup functions instead.  If you can try that, that would be
cool, I do not have access to a linux platform at home to try with.
Shane

Yasuo Ohgaki wrote:
> I get segfault with this patch during "make install"...
> 
> # It seems failed to send previous mail...
> # Sorry, if you get 2 mails
> 
> --
> Yasuo Ohgaki
> 
> 
> Shane Caraveo wrote:
> 
>>shane Sun Oct 13 04:38:09 2002 EDT
>>
>>  Modified files:  
>>/php4/mainphp_variables.c php_variables.h 
>>  Log:
>>  make php_import_environment_variables overwritable so fastcgi can correctly
>>  set $_ENV.
>>  
>>  
>>  
>>Index: php4/main/php_variables.c
>>diff -u php4/main/php_variables.c:1.44 php4/main/php_variables.c:1.45
>>--- php4/main/php_variables.c:1.44Sat Sep  7 20:27:05 2002
>>+++ php4/main/php_variables.c Sun Oct 13 04:38:09 2002
>>@@ -16,7 +16,7 @@
>>|  Zeev Suraski <[EMAIL PROTECTED]>|
>>+--+
>>  */
>>-/* $Id: php_variables.c,v 1.44 2002/09/08 00:27:05 yohgaki Exp $ */
>>+/* $Id: php_variables.c,v 1.45 2002/10/13 08:38:09 shane Exp $ */
>> 
>> #include 
>> #include "php.h"
>>@@ -28,6 +28,9 @@
>> 
>> #include "zend_globals.h"
>> 
>>+/* for systems that need to override reading of environment variables */
>>+void _php_import_environment_variables(zval *array_ptr TSRMLS_DC);
>>+PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC) = 
>_php_import_environment_variables;
>> 
>> PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_array 
>TSRMLS_DC)
>> {
>>@@ -318,8 +321,7 @@
>>  }
>> }
>> 
>>-
>>-void php_import_environment_variables(zval *array_ptr TSRMLS_DC)
>>+void _php_import_environment_variables(zval *array_ptr TSRMLS_DC)
>> {
>>  char **env, *p, *t;
>> 
>>Index: php4/main/php_variables.h
>>diff -u php4/main/php_variables.h:1.13 php4/main/php_variables.h:1.14
>>--- php4/main/php_variables.h:1.13Tue Dec 11 10:31:05 2001
>>+++ php4/main/php_variables.h Sun Oct 13 04:38:09 2002
>>@@ -17,7 +17,7 @@
>>+--+
>> */
>> 
>>-/* $Id: php_variables.h,v 1.13 2001/12/11 15:31:05 sebastian Exp $ */
>>+/* $Id: php_variables.h,v 1.14 2002/10/13 08:38:09 shane Exp $ */
>> 
>> #ifndef PHP_VARIABLES_H
>> #define PHP_VARIABLES_H
>>@@ -31,7 +31,7 @@
>> #define PARSE_STRING 3
>> 
>> void php_treat_data(int arg, char *str, zval* destArray TSRMLS_DC);
>>-PHPAPI void php_import_environment_variables(zval *array_ptr TSRMLS_DC);
>>+extern PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC);
>> PHPAPI void php_register_variable(char *var, char *val, pval *track_vars_array 
>TSRMLS_DC);
>> /* binary-safe version */
>> PHPAPI void php_register_variable_safe(char *var, char *val, int val_len, pval 
>*track_vars_array TSRMLS_DC);
>>
>>
> 
> 
> 
> 



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




[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c

2002-10-13 Thread Sander Roobol

sander  Sat Oct 12 12:16:37 2002 EDT

  Modified files:  
/php4/ext/domxmlphp_domxml.c 
  Log:
  Typo
  
  
Index: php4/ext/domxml/php_domxml.c
diff -u php4/ext/domxml/php_domxml.c:1.212 php4/ext/domxml/php_domxml.c:1.213
--- php4/ext/domxml/php_domxml.c:1.212  Fri Oct 11 10:00:12 2002
+++ php4/ext/domxml/php_domxml.cSat Oct 12 12:16:36 2002
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.212 2002/10/11 14:00:12 chregu Exp $ */
+/* $Id: php_domxml.c,v 1.213 2002/10/12 16:16:36 sander Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -2580,7 +2580,7 @@
DOMXML_PARAM_NONE(nodep, id, le_domxmlnodep);
ret = node_attributes(&attrs, nodep TSRMLS_CC);
if ( ret == -1) {
-   return NULL;
+   RETURN_NULL();
}
 
if ( ret > -1) {



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




[PHP-CVS] cvs: php4 /sapi/embed config.m4

2002-10-13 Thread Jani Taskinen

sniper  Fri Oct 11 19:28:01 2002 EDT

  Modified files:  
/php4/sapi/embedconfig.m4 
  Log:
  - Removed the unnecessary extra configure option --enable-shared-embed
  - Changed --enable-embed to accept parameters shared/static and default
to static build.
  
  
Index: php4/sapi/embed/config.m4
diff -u php4/sapi/embed/config.m4:1.1 php4/sapi/embed/config.m4:1.2
--- php4/sapi/embed/config.m4:1.1   Sun Sep 29 12:22:48 2002
+++ php4/sapi/embed/config.m4   Fri Oct 11 19:28:01 2002
@@ -1,14 +1,30 @@
-PHP_ARG_ENABLE(embed,whether to enable the embedded SAPI module,
-[  --enable-embed])
+dnl
+dnl $Id: config.m4,v 1.2 2002/10/11 23:28:01 sniper Exp $
+dnl
 
-PHP_ARG_ENABLE(embed-shared,whether to build it as shared library,
-[  --enable-embed-shared])
+AC_MSG_CHECKING(for embedded SAPI library support)
 
-if test "$PHP_EMBED" = "yes"; then
-  if test "$PHP_EMBED_SHARED" = "yes"; then
-ac_type=shared
-  else
-ac_type=static
-  fi
-  PHP_SELECT_SAPI(embed, $ac_type, php_embed.c)
+AC_ARG_ENABLE(embed,
+[  --enable-embed[=TYPE]   Enable building embedded SAPI library of PHP
+  TYPE is either 'shared' or 'static'. Defaults to 'static' 
+library.],
+[ 
+  case $enableval in
+yes|static)
+  PHP_EMBED_TYPE=static
+  ;;
+shared)
+  PHP_EMBED_TYPE=shared
+  ;;
+*)
+  PHP_EMBED_TYPE=no
+  ;;
+  esac
+],[
+  PHP_EMBED=no
+])
+
+AC_MSG_RESULT($PHP_EMBED_TYPE)
+
+if test "$PHP_EMBED_TYPE" != "no"; then
+  PHP_SELECT_SAPI(embed, $PHP_EMBED_TYPE, php_embed.c)
 fi



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




[PHP-CVS] cvs: php4 /sapi/embed config.m4

2002-10-13 Thread Jani Taskinen

sniper  Fri Oct 11 20:54:53 2002 EDT

  Modified files:  
/php4/sapi/embedconfig.m4 
  Log:
  Default to shared.
  
  
Index: php4/sapi/embed/config.m4
diff -u php4/sapi/embed/config.m4:1.2 php4/sapi/embed/config.m4:1.3
--- php4/sapi/embed/config.m4:1.2   Fri Oct 11 19:28:01 2002
+++ php4/sapi/embed/config.m4   Fri Oct 11 20:54:53 2002
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: config.m4,v 1.2 2002/10/11 23:28:01 sniper Exp $
+dnl $Id: config.m4,v 1.3 2002/10/12 00:54:53 sniper Exp $
 dnl
 
 AC_MSG_CHECKING(for embedded SAPI library support)
@@ -9,11 +9,11 @@
   TYPE is either 'shared' or 'static'. Defaults to 'static' 
library.],
 [ 
   case $enableval in
-yes|static)
-  PHP_EMBED_TYPE=static
-  ;;
-shared)
+yes|shared)
   PHP_EMBED_TYPE=shared
+  ;;
+static)
+  PHP_EMBED_TYPE=static
   ;;
 *)
   PHP_EMBED_TYPE=no



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




[PHP-CVS] cvs: php4 / NEWS

2002-10-13 Thread James Cox

imajes  Sat Oct 12 13:47:45 2002 EDT

  Modified files:  
/php4   NEWS 
  Log:
  mention vpopmail.
  
  
Index: php4/NEWS
diff -u php4/NEWS:1.1200 php4/NEWS:1.1201
--- php4/NEWS:1.1200Sat Oct 12 10:59:40 2002
+++ php4/NEWS   Sat Oct 12 13:47:45 2002
@@ -9,6 +9,7 @@
   . ext/ccvs
   . ext/cybercash
   . ext/icap
+- Moved ext/vpopmail to PECL. (James)
 - Added ICONV_IMPL and ICONV_VERSION constants to iconv extension to
   indicate which iconv implementation is used. (Moriyoshi)
 - Added experimental patch to address problem with floats on various locales.



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




[PHP-CVS] cvs: php4 /ext/db/tests .cvsignore

2002-10-13 Thread Jani Taskinen

sniper  Sun Oct 13 04:08:53 2002 EDT

  Modified files:  
/php4/ext/db/tests  .cvsignore 
  Log:
  ignore test.dbm
  
  
Index: php4/ext/db/tests/.cvsignore
diff -u php4/ext/db/tests/.cvsignore:1.5 php4/ext/db/tests/.cvsignore:1.6
--- php4/ext/db/tests/.cvsignore:1.5Mon Oct  7 23:00:58 2002
+++ php4/ext/db/tests/.cvsignoreSun Oct 13 04:08:53 2002
@@ -1,3 +1,4 @@
+test.dbm
 phpt.*
 *.diff
 *.log



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




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-10-13 Thread Yasuo Ohgaki

yohgaki Sun Oct 13 05:48:19 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Fixed proto. Clean up.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.234 php4/ext/pgsql/pgsql.c:1.235
--- php4/ext/pgsql/pgsql.c:1.234Sun Oct 13 05:41:35 2002
+++ php4/ext/pgsql/pgsql.c  Sun Oct 13 05:48:18 2002
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.234 2002/10/13 09:41:35 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.235 2002/10/13 09:48:18 yohgaki Exp $ */
 
 #include 
 
@@ -618,7 +618,7 @@
if (Z_TYPE_P(index_ptr) != le_index_ptr) {
RETURN_FALSE;
}
-   link = (int) (long) index_ptr->ptr; /* XXX: bogus? cast */
+   link = (int) index_ptr->ptr;
ptr = zend_list_find(link,&type);   /* check if the link is 
still there */
if (ptr && (type==le_link || type==le_plink)) {
Z_LVAL_P(return_value) = link;
@@ -850,7 +850,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool pg_ping([resource connection])
+/* {{{ proto bool pg_ping(resource connection)
Ping database. If connection is bad, try to reconnect. */
 PHP_FUNCTION(pg_ping)
 {



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




[PHP-CVS] cvs: php4 /ext/standard/tests/file .cvsignore

2002-10-13 Thread Jani Taskinen

sniper  Sun Oct 13 04:08:07 2002 EDT

  Modified files:  
/php4/ext/standard/tests/file   .cvsignore 
  Log:
  These should be ignored.
  
  
Index: php4/ext/standard/tests/file/.cvsignore
diff -u php4/ext/standard/tests/file/.cvsignore:1.6 
php4/ext/standard/tests/file/.cvsignore:1.7
--- php4/ext/standard/tests/file/.cvsignore:1.6 Mon Oct  7 23:01:07 2002
+++ php4/ext/standard/tests/file/.cvsignore Sun Oct 13 04:08:07 2002
@@ -1,3 +1,5 @@
+test.file
+test.link
 phpt.*
 *.diff
 *.log



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




[PHP-CVS] cvs: php4 / NEWS

2002-10-13 Thread Jani Taskinen

sniper  Sat Oct 12 19:05:35 2002 EDT

  Modified files:  
/php4   NEWS 
  Log:
  Add note about fhttpd removal.
  
  
Index: php4/NEWS
diff -u php4/NEWS:1.1201 php4/NEWS:1.1202
--- php4/NEWS:1.1201Sat Oct 12 13:47:45 2002
+++ php4/NEWS   Sat Oct 12 19:05:34 2002
@@ -9,6 +9,7 @@
   . ext/ccvs
   . ext/cybercash
   . ext/icap
+  . sapi/fhttpd
 - Moved ext/vpopmail to PECL. (James)
 - Added ICONV_IMPL and ICONV_VERSION constants to iconv extension to
   indicate which iconv implementation is used. (Moriyoshi)



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




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-10-13 Thread Yasuo Ohgaki

yohgaki Sun Oct 13 05:41:36 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Need to init connstring when there are 2 args.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.233 php4/ext/pgsql/pgsql.c:1.234
--- php4/ext/pgsql/pgsql.c:1.233Sun Oct 13 05:37:27 2002
+++ php4/ext/pgsql/pgsql.c  Sun Oct 13 05:41:35 2002
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.233 2002/10/13 09:37:27 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.234 2002/10/13 09:41:35 yohgaki Exp $ */
 
 #include 
 
@@ -511,6 +511,7 @@
if (ZEND_NUM_ARGS() == 1) { /* new style, using connection string */
connstring = Z_STRVAL_PP(args[0]);
} else if (ZEND_NUM_ARGS() == 2 ) { /* Safe to add conntype_option, since 2 
args was illegal */
+   connstring = Z_STRVAL_PP(args[0]);
convert_to_long_ex(args[1]);
connect_type = Z_LVAL_PP(args[1]);
} else {



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




[PHP-CVS] cvs: php4 /ext/ftp ftp.c

2002-10-13 Thread Ilia Alshanetsky

iliaa   Sat Oct 12 21:40:46 2002 EDT

  Modified files:  
/php4/ext/ftp   ftp.c 
  Log:
  Fixed ZTS build
  Fixed 2 ZTS related warnings
  
  
Index: php4/ext/ftp/ftp.c
diff -u php4/ext/ftp/ftp.c:1.67 php4/ext/ftp/ftp.c:1.68
--- php4/ext/ftp/ftp.c:1.67 Fri Oct  4 18:20:08 2002
+++ php4/ext/ftp/ftp.c  Sat Oct 12 21:40:46 2002
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: ftp.c,v 1.67 2002/10/04 22:20:08 sesser Exp $ */
+/* $Id: ftp.c,v 1.68 2002/10/13 01:40:46 iliaa Exp $ */
 
 #include "php.h"
 
@@ -226,6 +226,8 @@
 {
 #if HAVE_OPENSSL_EXT
SSL_CTX *ctx = NULL;
+   
+   TSRMLS_FETCH();
 #endif
if (ftp == NULL)
return 0;
@@ -1346,11 +1348,13 @@
 databuf_t*
 data_accept(databuf_t *data, ftpbuf_t *ftp)
 {
+   php_sockaddr_storage addr;
+   int size;
+
 #if HAVE_OPENSSL_EXT
SSL_CTX *ctx;
+   TSRMLS_FETCH(); 
 #endif
-   php_sockaddr_storage addr;
-   int size;
 
if (data->fd != -1)
goto data_accepted;
@@ -1549,7 +1553,6 @@
 {
databuf_t   *data = NULL;
chararg[11];
-   TSRMLS_FETCH();
 
if (ftp == NULL)
goto bail;
@@ -1666,7 +1669,6 @@
 {
databuf_t   *data = NULL;
chararg[11];
-   TSRMLS_FETCH();
 
if (ftp == NULL)
return 0;



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




[PHP-CVS] cvs: php4 /sapi/cgi CREDITS README.FastCGI cgi_main.c

2002-10-13 Thread Shane Caraveo

shane   Sun Oct 13 05:40:44 2002 EDT

  Added files: 
/php4/sapi/cgi  README.FastCGI 

  Modified files:  
/php4/sapi/cgi  CREDITS cgi_main.c 
  Log:
  make fastcgi usage threadsafe, ready for future multithreaded fastcgi implementation
  get rid of environment overwriting but hooking into php's environment function
  set $_ENV correctly for mod_fastcgi
  add -b to specify binding for fastcgi
  new readme file with information for running under apache2.0 and iis
  
  

Index: php4/sapi/cgi/CREDITS
diff -u php4/sapi/cgi/CREDITS:1.1 php4/sapi/cgi/CREDITS:1.2
--- php4/sapi/cgi/CREDITS:1.1   Mon Nov 20 05:31:08 2000
+++ php4/sapi/cgi/CREDITS   Sun Oct 13 05:40:44 2002
@@ -1,2 +1,2 @@
-CGI
-Rasmus Lerdorf, Stig Bakken
+CGI / FastCGI
+Rasmus Lerdorf, Stig Bakken, Shane Caraveo
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.182 php4/sapi/cgi/cgi_main.c:1.183
--- php4/sapi/cgi/cgi_main.c:1.182  Mon Sep 23 07:35:22 2002
+++ php4/sapi/cgi/cgi_main.cSun Oct 13 05:40:44 2002
@@ -82,22 +82,14 @@
 #include "fcgi_config.h"
 #include "fcgiapp.h"
 /* don't want to include fcgios.h, causes conflicts */
+#ifdef PHP_WIN32
 extern int OS_SetImpersonate(void);
+#endif
 
-FCGX_Stream *in, *out, *err;
-FCGX_ParamArray envp;
-
-/* Our original environment from when the FastCGI first started */
-char **orig_env;
-
-/* The environment given by the FastCGI */
-char **cgi_env;
-
-/* The manufactured environment, from merging the base environ with
- * the parameters set by the per-connection environment
- */
-char **merge_env;
+static void (*php_php_import_environment_variables)(zval *array_ptr TSRMLS_DC);
 
+#ifndef PHP_WIN32
+/* these globals used for forking children on unix systems */
 /**
  * Number of child processes that will get created to service requests
  */
@@ -112,7 +104,7 @@
  * Process group
  */
 static pid_t pgroup;
-
+#endif
 
 #endif
 
@@ -143,7 +135,7 @@
 #define STDOUT_FILENO 1
 #endif
 
-static inline size_t sapi_cgibin_single_write(const char *str, uint str_length)
+static inline size_t sapi_cgibin_single_write(const char *str, uint str_length 
+TSRMLS_DC)
 {
 #ifdef PHP_WRITE_STDOUT
long ret;
@@ -153,7 +145,12 @@
 
 #ifdef PHP_FASTCGI
if (!FCGX_IsCGI()) {
-   return FCGX_PutStr( str, str_length, out );
+   FCGX_Request *request = (FCGX_Request *)SG(server_context);
+   long ret = FCGX_PutStr( str, str_length, request->out );
+   if (ret <= 0) {
+   return 0;
+   }
+   return ret;
}
 #endif
 #ifdef PHP_WRITE_STDOUT
@@ -174,7 +171,7 @@
 
while (remaining > 0)
{
-   ret = sapi_cgibin_single_write(ptr, remaining);
+   ret = sapi_cgibin_single_write(ptr, remaining TSRMLS_CC);
if (!ret) {
php_handle_aborted_connection();
}
@@ -190,7 +187,8 @@
 {
 #ifdef PHP_FASTCGI
if (!FCGX_IsCGI()) {
-   if( FCGX_FFlush( out ) == -1 ) {
+   FCGX_Request *request = (FCGX_Request *)server_context;
+   if(!request || FCGX_FFlush( request->out ) == -1 ) {
php_handle_aborted_connection();
}
} else
@@ -244,7 +242,8 @@
while (read_bytes < count_bytes) {
 #ifdef PHP_FASTCGI
if (!FCGX_IsCGI()) {
-   tmp_read_bytes = FCGX_GetStr( pos, count_bytes-read_bytes, in 
);
+   FCGX_Request *request = (FCGX_Request *)SG(server_context);
+   tmp_read_bytes = FCGX_GetStr( pos, count_bytes-read_bytes, 
+request->in );
pos += tmp_read_bytes;
} else
 #endif
@@ -258,12 +257,55 @@
return read_bytes;
 }
 
+static char *sapi_cgibin_getenv(char *name, size_t name_len TSRMLS_DC)
+{
+#ifdef PHP_FASTCGI
+   /* when php is started by mod_fastcgi, no regular environment
+  is provided to PHP.  It is always sent to PHP at the start
+  of a request.  So we have to do our own lookup to get env
+  vars.  This could probably be faster somehow.  */
+   if (!FCGX_IsCGI()) {
+   int cgi_env_size = 0;
+   FCGX_Request *request = (FCGX_Request *)SG(server_context);
+   while( request->envp[ cgi_env_size ] ) { 
+   if (strnicmp(name,request->envp[cgi_env_size],name_len) == 0) {
+   return (request->envp[cgi_env_size])+name_len+1;
+   }
+   cgi_env_size++; 
+   }
+   }
+#endif
+   /*  if cgi, or fastcgi and not found in fcgi env
+   check the regular environment */
+   return getenv(name);
+}
 
 static char *sapi_cgi_read_cookies(TSRMLS_D)
 {
-   return getenv("HTTP_COOKIE");
+   return sapi_cgibin_getenv((char *)"HTTP_COOKIE",strlen("HTTP_COOKIE") 
+TSRMLS_CC);
 }
 
+#i

[PHP-CVS] cvs: php4 /sapi/cgi config.m4 /sapi/fhttpd .cvsignore CREDITS fhttpd.c

2002-10-13 Thread Jani Taskinen

sniper  Sat Oct 12 19:02:43 2002 EDT

  Removed files:   
/php4/sapi/fhttpd   .cvsignore CREDITS fhttpd.c 

  Modified files:  
/php4/sapi/cgi  config.m4 
  Log:
  - Removed sapi/fhttpd (this webserver is dead)
  
  
  
Index: php4/sapi/cgi/config.m4
diff -u php4/sapi/cgi/config.m4:1.20 php4/sapi/cgi/config.m4:1.21
--- php4/sapi/cgi/config.m4:1.20Fri Oct 11 21:48:47 2002
+++ php4/sapi/cgi/config.m4 Sat Oct 12 19:02:42 2002
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: config.m4,v 1.20 2002/10/12 01:48:47 sniper Exp $
+dnl $Id: config.m4,v 1.21 2002/10/12 23:02:42 sniper Exp $
 dnl
 
 AC_DEFUN(PHP_TEST_WRITE_STDOUT,[
@@ -65,48 +65,14 @@
   AC_DEFINE_UNQUOTED(DISCARD_PATH, $DISCARD_PATH, [ ])
 
   INSTALL_IT="\$(INSTALL) -m 0755 \$(SAPI_CGI_PATH) 
\$(INSTALL_ROOT)\$(bindir)/php-cgi"
-fi
 
-AC_MSG_CHECKING(for fhttpd module support)
-AC_ARG_WITH(fhttpd,
-[  --with-fhttpd[=DIR] Build fhttpd module.  DIR is the fhttpd sources
-  directory, defaults to /usr/local/src/fhttpd.],
-[
-if test "$withval" = "yes"; then
-  # fhttpd source directory
-  withval=/usr/local/src/fhttpd
-fi
-if test "$withval" != "no"; then
-# For fhttpd 0.3.x
-  if test -f $withval/servproc.h; then 
-FHTTPD_INCLUDE=-I$withval/
-FHTTPD_LIB=$withval/servproc.o
-FHTTPD_TARGET=$withval/
-PHP_BUILD_STATIC
-PHP_SAPI=cgi
-AC_DEFINE(FHTTPD,1,[ ])
-AC_MSG_RESULT(yes - fhttpd 0.3.x)
-  else
-AC_MSG_RESULT(no)
-AC_MSG_ERROR(Invalid fhttpd directory - unable to find servproc.h under 
$withval)
-  fi
-else
-  AC_MSG_RESULT(no)
-fi
-],[
-AC_MSG_RESULT(no)
-])
-INCLUDES="$INCLUDES $FHTTPD_INCLUDE"
-dnl## AC_SUBST(FHTTPD_INCLUDE)
-PHP_SUBST(FHTTPD_LIB)
-PHP_SUBST(FHTTPD_TARGET)
-
-case $host_alias in
-  *darwin*)
-BUILD_CGI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) 
\$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_SAPI_OBJS:.lo=.o) 
\$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
-;;
-  *)
-BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) 
\$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) 
\$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
-;;
-esac
-PHP_SUBST(BUILD_CGI)
+  case $host_alias in
+*darwin*)
+  BUILD_CGI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) 
+\$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_SAPI_OBJS:.lo=.o) 
+\$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
+  ;;
+*)
+  BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) 
+\$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) 
+\$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
+  ;;
+  esac
+  PHP_SUBST(BUILD_CGI)
+fi



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




[PHP-CVS] cvs: php4 /ext/session/tests 015.phpt

2002-10-13 Thread Derick Rethans

derick  Sat Oct 12 13:12:43 2002 EDT

  Modified files:  
/php4/ext/session/tests 015.phpt 
  Log:
  - Hardcode setting which affects the test
  
  
Index: php4/ext/session/tests/015.phpt
diff -u php4/ext/session/tests/015.phpt:1.1 php4/ext/session/tests/015.phpt:1.2
--- php4/ext/session/tests/015.phpt:1.1 Thu Oct  3 12:43:44 2002
+++ php4/ext/session/tests/015.phpt Sat Oct 12 13:12:43 2002
@@ -6,6 +6,7 @@
 session.use_trans_sid=1
 session.use_cookies=0
 session.cache_limiter=
+arg_separator.output=&
 --FILE--
 http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /sapi/cgi/libfcgi os_win32.c

2002-10-13 Thread Shane Caraveo

shane   Sun Oct 13 01:55:03 2002 EDT

  Modified files:  
/php4/sapi/cgi/libfcgi  os_win32.c 
  Log:
  fix invalid handle issue that shutdown php fastcgi prematurly
  fix checking os name for impersonation
  
  
Index: php4/sapi/cgi/libfcgi/os_win32.c
diff -u php4/sapi/cgi/libfcgi/os_win32.c:1.4 php4/sapi/cgi/libfcgi/os_win32.c:1.5
--- php4/sapi/cgi/libfcgi/os_win32.c:1.4Sun Mar 17 23:48:34 2002
+++ php4/sapi/cgi/libfcgi/os_win32.cSun Oct 13 01:55:03 2002
@@ -17,7 +17,7 @@
  *  significantly more enjoyable.)
  */
 #ifndef lint
-static const char rcsid[] = "$Id: os_win32.c,v 1.4 2002/03/18 04:48:34 shane Exp $";
+static const char rcsid[] = "$Id: os_win32.c,v 1.5 2002/10/13 05:55:03 shane Exp $";
 #endif /* not lint */
 
 #define WIN32_LEAN_AND_MEAN 
@@ -295,7 +295,7 @@
 {
char *os_name = NULL;
os_name = getenv("OS");
-   if (stricmp(os_name, "Windows_NT") == 0) {
+   if (os_name && stricmp(os_name, "Windows_NT") == 0) {
bImpersonate = TRUE;
return 1;
}
@@ -524,7 +524,6 @@
 stdioHandles[STDOUT_FILENO] = GetStdHandle(STD_OUTPUT_HANDLE);
 if(!SetHandleInformation(stdioHandles[STDOUT_FILENO],
 HANDLE_FLAG_INHERIT, FALSE)) {
-DebugBreak();
//exit(99);
return -1;
 }
@@ -543,7 +542,6 @@
 stdioHandles[STDERR_FILENO] = GetStdHandle(STD_ERROR_HANDLE);
 if(!SetHandleInformation(stdioHandles[STDERR_FILENO],
 HANDLE_FLAG_INHERIT, FALSE)) {
-DebugBreak();
//exit(99);
return -1;
 }
@@ -788,11 +786,6 @@
 HANDLE mutex = INVALID_HANDLE_VALUE;
 char mutexEnvString[100];
 
-if (mutex == NULL)
-{
-return -2;
-}
-
if (bCreateMutex) {
mutex = CreateMutex(NULL, FALSE, NULL);
if (! SetHandleInformation(mutex, HANDLE_FLAG_INHERIT, TRUE))
@@ -983,7 +976,7 @@
 if (p) {
 int len = p - bindPath + 1;
 
-host = malloc(len);
+host = (char *)malloc(len);
 if (!host) {
 fprintf(stderr, "Unable to allocate memory\n");
 return -1;
@@ -1543,8 +1536,12 @@
 /*
  * CloseHandle returns: TRUE success, 0 failure
  */
+/*
+XXX don't close here, fcgi apps fail if we do so
+need to examine resource leaks if any might exist
if (CloseHandle(fdTable[fd].fid.fileHandle) == FALSE)
ret = -1;
+   */
 break;
 case FD_SOCKET_SYNC:
case FD_SOCKET_ASYNC:



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




[PHP-CVS] cvs: php4 /sapi/thttpd thttpd_patch

2002-10-13 Thread Sascha Schumann

sas Sun Oct 13 07:54:08 2002 EDT

  Modified files:  
/php4/sapi/thttpd   thttpd_patch 
  Log:
  Redo the patch on Linux, the cygwin diff seems to be a bit broken.
  
  
Index: php4/sapi/thttpd/thttpd_patch
diff -u php4/sapi/thttpd/thttpd_patch:1.20 php4/sapi/thttpd/thttpd_patch:1.21
--- php4/sapi/thttpd/thttpd_patch:1.20  Sun Oct 13 07:50:16 2002
+++ php4/sapi/thttpd/thttpd_patch   Sun Oct 13 07:54:08 2002
@@ -1,6 +1,6 @@
 diff -ur thttpd-2.21b/Makefile.in thttpd-2.21b-cool/Makefile.in
 thttpd-2.21b/Makefile.in   2001-03-29 20:36:22.0 +0200
-+++ thttpd-2.21b-cool/Makefile.in  2002-10-13 13:33:24.0 +0200
+--- thttpd-2.21b/Makefile.in   Thu Mar 29 20:36:21 2001
 thttpd-2.21b-cool/Makefile.in  Sun Oct 13 13:52:58 2002
 @@ -46,13 +46,15 @@
  
  # You shouldn't need to edit anything below here.
@@ -28,19 +28,19 @@
  
  OBJ = $(SRC:.c=.o) @LIBOBJS@
  
-@@ -152,6 +154,9 @@
+@@ -151,6 +153,9 @@
+ 
  tags:
ctags -wtd *.c *.h
- 
++
 +php_thttpd.o: php_thttpd.c
 +  $(CC) $(PHP_CFLAGS) $(CFLAGS) -c php_thttpd.c
-+
+ 
  tar:
@name=`sed -n -e '/SERVER_SOFTWARE/!d' -e 's,.*thttpd/,thttpd-,' -e 's, .*,,p' 
version.h` ; \
- rm -rf $$name ; \
 diff -ur thttpd-2.21b/config.h thttpd-2.21b-cool/config.h
 thttpd-2.21b/config.h  2001-04-09 23:57:36.0 +0200
-+++ thttpd-2.21b-cool/config.h 2002-10-13 13:33:24.0 +0200
+--- thttpd-2.21b/config.h  Mon Apr  9 23:57:36 2001
 thttpd-2.21b-cool/config.h Sun Oct 13 13:52:58 2002
 @@ -82,6 +82,11 @@
  */
  #define IDLE_READ_TIMELIMIT 60
@@ -63,8 +63,8 @@
  /* CONFIGURE: If this is defined then thttpd will automatically generate
  ** index pages for directories that don't have an explicit index file.
 diff -ur thttpd-2.21b/fdwatch.c thttpd-2.21b-cool/fdwatch.c
 thttpd-2.21b/fdwatch.c 2001-04-13 07:36:08.0 +0200
-+++ thttpd-2.21b-cool/fdwatch.c2002-10-13 13:47:42.0 +0200
+--- thttpd-2.21b/fdwatch.c Fri Apr 13 07:36:08 2001
 thttpd-2.21b-cool/fdwatch.cSun Oct 13 13:52:58 2002
 @@ -460,7 +460,7 @@
  
  ridx = 0;
@@ -86,8 +86,8 @@
}
  }
 diff -ur thttpd-2.21b/libhttpd.c thttpd-2.21b-cool/libhttpd.c
 thttpd-2.21b/libhttpd.c2001-04-24 00:42:40.0 +0200
-+++ thttpd-2.21b-cool/libhttpd.c   2002-10-13 13:41:38.0 +0200
+--- thttpd-2.21b/libhttpd.cTue Apr 24 00:42:40 2001
 thttpd-2.21b-cool/libhttpd.c   Sun Oct 13 13:52:58 2002
 @@ -85,6 +85,12 @@
  #include "match.h"
  #include "tdate_parse.h"
@@ -479,8 +479,8 @@
}
  
 diff -ur thttpd-2.21b/libhttpd.h thttpd-2.21b-cool/libhttpd.h
 thttpd-2.21b/libhttpd.h2001-04-24 00:36:50.0 +0200
-+++ thttpd-2.21b-cool/libhttpd.h   2002-10-13 13:38:28.0 +0200
+--- thttpd-2.21b/libhttpd.hTue Apr 24 00:36:50 2001
 thttpd-2.21b-cool/libhttpd.h   Sun Oct 13 13:52:58 2002
 @@ -69,6 +69,7 @@
  char* server_hostname;
  int port;
@@ -508,8 +508,8 @@
  /* Call this to de-initialize a connection struct and *really* free the
  ** mallocced strings.
 diff -ur thttpd-2.21b/mime_encodings.txt thttpd-2.21b-cool/mime_encodings.txt
 thttpd-2.21b/mime_encodings.txt2000-05-10 03:22:28.0 +0200
-+++ thttpd-2.21b-cool/mime_encodings.txt   2002-10-13 13:33:24.0 +0200
+--- thttpd-2.21b/mime_encodings.txtWed May 10 03:22:28 2000
 thttpd-2.21b-cool/mime_encodings.txt   Sun Oct 13 13:52:58 2002
 @@ -3,6 +3,6 @@
  # A list of file extensions followed by the corresponding MIME encoding.
  # Extensions not found in the table proceed to the mime_types table.
@@ -520,8 +520,8 @@
 +gzgzip
  uux-uuencode
 diff -ur thttpd-2.21b/mime_types.txt thttpd-2.21b-cool/mime_types.txt
 thttpd-2.21b/mime_types.txt2001-04-14 04:53:30.0 +0200
-+++ thttpd-2.21b-cool/mime_types.txt   2002-10-13 13:33:24.0 +0200
+--- thttpd-2.21b/mime_types.txtSat Apr 14 04:53:30 2001
 thttpd-2.21b-cool/mime_types.txt   Sun Oct 13 13:52:58 2002
 @@ -1,135 +1,138 @@
 -# mime_types.txt
 -#
@@ -771,8 +771,8 @@
 +movie video/x-sgi-movie
 +ice   x-conference/x-cooltalk
 diff -ur thttpd-2.21b/mmc.c thttpd-2.21b-cool/mmc.c
 thttpd-2.21b/mmc.c 2001-04-13 23:02:16.0 +0200
-+++ thttpd-2.21b-cool/mmc.c2002-10-13 13:33:24.0 +0200
+--- thttpd-2.21b/mmc.c Fri Apr 13 23:02:15 2001
 thttpd-2.21b-cool/mmc.cSun Oct 13 13:52:58 2002
 @@ -70,6 +70,7 @@
  unsigned int hash;
  int hash_idx;
@@ -843,8 +843,8 @@
m->reftime = nowP->tv_sec;
else
 diff -ur thttpd-2.21b/mmc.h thttpd-2.21b-cool/mmc.h
 thttpd-2.21b/mmc.h 2001-04-13 07:36:54.0 +0200
-+++ thttpd-2.21b-cool/mmc.h2002-10-13 13:33:24.0 +0200
+--- thttpd-2.21b/mmc.h Fri Apr 13 07:36:54 2001
 thttpd-2.21b-cool/mmc.hSun Oct 13 13:52:58 2002
 @@ -31,8 +31,9 @@
  /* Returns an mmap()ed area for the given file, or (void*) 0 on errors.
  ** If

[PHP-CVS] cvs: php4 /ext/standard/tests/file 003.inc 003.phpt

2002-10-13 Thread Derick Rethans

derick  Sat Oct 12 12:53:13 2002 EDT

  Removed files:   
/php4/ext/standard/tests/file   003.inc 

  Modified files:  
/php4/ext/standard/tests/file   003.phpt 
  Log:
  - Make the test do what it says
  
  
Index: php4/ext/standard/tests/file/003.phpt
diff -u php4/ext/standard/tests/file/003.phpt:1.4 
php4/ext/standard/tests/file/003.phpt:1.5
--- php4/ext/standard/tests/file/003.phpt:1.4   Wed May 15 21:07:21 2002
+++ php4/ext/standard/tests/file/003.phpt   Sat Oct 12 12:53:13 2002
@@ -3,15 +3,41 @@
 --POST--
 --GET--
 --FILE--
-
+
 --EXPECT--
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
+boolean
+boolean
+boolean
+boolean
+boolean
+boolean
+boolean
+boolean
+boolean
+boolean



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




[PHP-CVS] cvs: php4 /ext/standard http_fopen_wrapper.c

2002-10-13 Thread Wez Furlong

wez Sat Oct 12 21:03:44 2002 EDT

  Modified files:  
/php4/ext/standard  http_fopen_wrapper.c 
  Log:
  Make PHP follow 301 correctly.
  # There may be other cases that need handling properly; I'll have to spend
  # some time investigating why we even need special cases now; it's got
  # something to do with Ilia's patch to fix memory leaks.
  
  
Index: php4/ext/standard/http_fopen_wrapper.c
diff -u php4/ext/standard/http_fopen_wrapper.c:1.52 
php4/ext/standard/http_fopen_wrapper.c:1.53
--- php4/ext/standard/http_fopen_wrapper.c:1.52 Sat Sep 28 18:14:21 2002
+++ php4/ext/standard/http_fopen_wrapper.c  Sat Oct 12 21:03:43 2002
@@ -18,7 +18,7 @@
|  Wez Furlong <[EMAIL PROTECTED]>  |
+--+
  */
-/* $Id: http_fopen_wrapper.c,v 1.52 2002/09/28 22:14:21 wez Exp $ */ 
+/* $Id: http_fopen_wrapper.c,v 1.53 2002/10/13 01:03:43 wez Exp $ */ 
 
 #include "php.h"
 #include "php_globals.h"
@@ -249,6 +249,7 @@
switch(response_code) {
case 200:
case 302:
+   case 301:
reqok = 1;
break;
case 403:



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




[PHP-CVS] cvs: php4 /sapi/thttpd thttpd_patch

2002-10-13 Thread Sascha Schumann

sas Sun Oct 13 07:50:16 2002 EDT

  Modified files:  
/php4/sapi/thttpd   thttpd_patch 
  Log:
  PHP + thttpd (+IRCG) build using CYGWIN now
  
  

Index: php4/sapi/thttpd/thttpd_patch
diff -u php4/sapi/thttpd/thttpd_patch:1.19 php4/sapi/thttpd/thttpd_patch:1.20
--- php4/sapi/thttpd/thttpd_patch:1.19  Mon Sep 23 11:41:44 2002
+++ php4/sapi/thttpd/thttpd_patch   Sun Oct 13 07:50:16 2002
@@ -1,6 +1,6 @@
 diff -ur thttpd-2.21b/Makefile.in thttpd-2.21b-cool/Makefile.in
 thttpd-2.21b/Makefile.in   Thu Mar 29 20:36:21 2001
-+++ thttpd-2.21b-cool/Makefile.in  Mon Sep 23 17:37:36 2002
+--- thttpd-2.21b/Makefile.in   2001-03-29 20:36:22.0 +0200
 thttpd-2.21b-cool/Makefile.in  2002-10-13 13:33:24.0 +0200
 @@ -46,13 +46,15 @@
  
  # You shouldn't need to edit anything below here.
@@ -28,19 +28,19 @@
  
  OBJ = $(SRC:.c=.o) @LIBOBJS@
  
-@@ -151,6 +153,9 @@
- 
+@@ -152,6 +154,9 @@
  tags:
ctags -wtd *.c *.h
-+
+ 
 +php_thttpd.o: php_thttpd.c
 +  $(CC) $(PHP_CFLAGS) $(CFLAGS) -c php_thttpd.c
- 
++
  tar:
@name=`sed -n -e '/SERVER_SOFTWARE/!d' -e 's,.*thttpd/,thttpd-,' -e 's, .*,,p' 
version.h` ; \
+ rm -rf $$name ; \
 diff -ur thttpd-2.21b/config.h thttpd-2.21b-cool/config.h
 thttpd-2.21b/config.h  Mon Apr  9 23:57:36 2001
-+++ thttpd-2.21b-cool/config.h Sun Sep 22 22:44:56 2002
+--- thttpd-2.21b/config.h  2001-04-09 23:57:36.0 +0200
 thttpd-2.21b-cool/config.h 2002-10-13 13:33:24.0 +0200
 @@ -82,6 +82,11 @@
  */
  #define IDLE_READ_TIMELIMIT 60
@@ -63,8 +63,8 @@
  /* CONFIGURE: If this is defined then thttpd will automatically generate
  ** index pages for directories that don't have an explicit index file.
 diff -ur thttpd-2.21b/fdwatch.c thttpd-2.21b-cool/fdwatch.c
 thttpd-2.21b/fdwatch.c Fri Apr 13 07:36:08 2001
-+++ thttpd-2.21b-cool/fdwatch.cMon Sep 23 17:38:03 2002
+--- thttpd-2.21b/fdwatch.c 2001-04-13 07:36:08.0 +0200
 thttpd-2.21b-cool/fdwatch.c2002-10-13 13:47:42.0 +0200
 @@ -460,7 +460,7 @@
  
  ridx = 0;
@@ -86,18 +86,22 @@
}
  }
 diff -ur thttpd-2.21b/libhttpd.c thttpd-2.21b-cool/libhttpd.c
 thttpd-2.21b/libhttpd.cTue Apr 24 00:42:40 2001
-+++ thttpd-2.21b-cool/libhttpd.c   Mon Sep 23 17:29:24 2002
-@@ -85,6 +85,8 @@
+--- thttpd-2.21b/libhttpd.c2001-04-24 00:42:40.0 +0200
 thttpd-2.21b-cool/libhttpd.c   2002-10-13 13:41:38.0 +0200
+@@ -85,6 +85,12 @@
  #include "match.h"
  #include "tdate_parse.h"
  
 +#include "php_thttpd.h"
 +
++#ifdef __CYGWIN__
++# define timezone _timezone
++#endif
++
  #ifndef STDIN_FILENO
  #define STDIN_FILENO 0
  #endif
-@@ -242,6 +244,8 @@
+@@ -242,6 +248,8 @@
free( (void*) hs->cwd );
  if ( hs->cgi_pattern != (char*) 0 )
free( (void*) hs->cgi_pattern );
@@ -106,7 +110,7 @@
  if ( hs->charset != (char*) 0 )
free( (void*) hs->charset );
  if ( hs->url_pattern != (char*) 0 )
-@@ -249,6 +253,7 @@
+@@ -249,6 +257,7 @@
  if ( hs->local_pattern != (char*) 0 )
free( (void*) hs->local_pattern );
  free( (void*) hs );
@@ -114,7 +118,7 @@
  }
  
  
-@@ -312,6 +317,7 @@
+@@ -312,6 +321,7 @@
}
  
  hs->port = port;
@@ -122,7 +126,7 @@
  if ( cgi_pattern == (char*) 0 )
hs->cgi_pattern = (char*) 0;
  else
-@@ -385,6 +391,8 @@
+@@ -385,6 +395,8 @@
return (httpd_server*) 0;
}
  
@@ -131,7 +135,7 @@
  /* Done initializing. */
  if ( hs->binding_hostname == (char*) 0 )
syslog( LOG_INFO, "%.80s starting on port %d", SERVER_SOFTWARE, hs->port );
-@@ -582,6 +590,9 @@
+@@ -582,6 +594,9 @@
  /* And send it, if necessary. */
  if ( hc->responselen > 0 )
{
@@ -141,7 +145,7 @@
(void) write( hc->conn_fd, hc->response, hc->responselen );
hc->responselen = 0;
}
-@@ -657,9 +668,9 @@
+@@ -657,9 +672,9 @@
(void) my_snprintf(
fixed_type, sizeof(fixed_type), type, hc->hs->charset );
(void) my_snprintf( buf, sizeof(buf),
@@ -153,7 +157,7 @@
add_response( hc, buf );
if ( encodings[0] != '\0' )
{
-@@ -681,6 +692,14 @@
+@@ -681,6 +696,14 @@
"Content-Length: %d\r\n", length );
add_response( hc, buf );
}
@@ -168,7 +172,7 @@
if ( extraheads[0] != '\0' )
add_response( hc, extraheads );
add_response( hc, "\r\n" );
-@@ -1603,6 +1622,61 @@
+@@ -1603,6 +1626,61 @@
  
  
  int
@@ -230,7 +234,7 @@
  httpd_get_conn( httpd_server* hs, int listen_fd, httpd_conn* hc )
  {
  httpd_sockaddr sa;
-@@ -1657,53 +1731,12 @@
+@@ -1657,53 +1735,12 @@
  hc->hs = hs;
  memset( &hc->client_addr, 0, sizeof(hc->client_addr) );
  memcpy( &hc->client_addr, &sa, sockaddr_len( &sa ) );
@@ -290,7 +294,7 @@
  }
  
  
-@@ -1720,6 +1753,9 @@
+@@ -1720,6 +1757,9 @@
  {
  char c;
  
@@ -300,7 +304,7 @@
  for ( 

[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c php_pgsql.h

2002-10-13 Thread Yasuo Ohgaki

yohgaki Sun Oct 13 05:37:27 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c php_pgsql.h 
  Log:
  Introduce connect_type option to pg_connect().
  pg_connect(conn_str, conn_type) is allowed. 
  @Added PGSQL_CONNECT_FORCE_NEW option to pg_connect() (Yasuo)
  # If you have better idea about constant name(s), let me know.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.232 php4/ext/pgsql/pgsql.c:1.233
--- php4/ext/pgsql/pgsql.c:1.232Sat Oct 12 23:00:47 2002
+++ php4/ext/pgsql/pgsql.c  Sun Oct 13 05:37:27 2002
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.232 2002/10/13 03:00:47 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.233 2002/10/13 09:37:27 yohgaki Exp $ */
 
 #include 
 
@@ -381,6 +381,8 @@
le_result = zend_register_list_destructors_ex(_free_result, NULL, "pgsql 
result", module_number);
le_lofp = zend_register_list_destructors_ex(_free_ptr, NULL, "pgsql large 
object", module_number);
le_string = zend_register_list_destructors_ex(_free_ptr, NULL, "pgsql string", 
module_number);
+   /* For connection option */
+   REGISTER_LONG_CONSTANT("PGSQL_CONNECT_FORCE_NEW", PGSQL_CONNECT_FORCE_NEW, 
+CONST_CS | CONST_PERSISTENT);
/* For pg_fetch_array() */
REGISTER_LONG_CONSTANT("PGSQL_ASSOC", PGSQL_ASSOC, CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PGSQL_NUM", PGSQL_NUM, CONST_CS | CONST_PERSISTENT);
@@ -489,9 +491,9 @@
PGconn *pgsql;
smart_str str = {0};
zval **args[5];
-   int i;
+   int i, connect_type = 0;
 
-   if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() == 2 || ZEND_NUM_ARGS() > 5
+   if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 5
|| zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == 
FAILURE) {
WRONG_PARAM_COUNT;
}
@@ -508,6 +510,9 @@
 
if (ZEND_NUM_ARGS() == 1) { /* new style, using connection string */
connstring = Z_STRVAL_PP(args[0]);
+   } else if (ZEND_NUM_ARGS() == 2 ) { /* Safe to add conntype_option, since 2 
+args was illegal */
+   convert_to_long_ex(args[1]);
+   connect_type = Z_LVAL_PP(args[1]);
} else {
host = Z_STRVAL_PP(args[0]);
port = Z_STRVAL_PP(args[1]);
@@ -596,7 +601,7 @@
pgsql = (PGconn *) le->ptr;
}
ZEND_REGISTER_RESOURCE(return_value, pgsql, le_plink);
-   } else {
+   } else { // Non persistent connection
list_entry *index_ptr,new_index_ptr;

/* first we check the hash for the hashed_details key.  if it exists,
@@ -604,7 +609,8 @@
 * if it doesn't, open a new pgsql link, add it to the resource list,
 * and add a pointer to it with hashed_details as the key.
 */
-   if (zend_hash_find(&EG(regular_list),str.c,str.len+1,(void **) 
&index_ptr)==SUCCESS) {
+   if (!(connect_type & PGSQL_CONNECT_FORCE_NEW)
+   && zend_hash_find(&EG(regular_list),str.c,str.len+1,(void **) 
+&index_ptr)==SUCCESS) {
int type,link;
void *ptr;
 
@@ -678,7 +684,7 @@
 /* }}} */
 #endif
 
-/* {{{ proto resource pg_connect([string connection_string] | [string host, string 
port [, string options [, string tty,]] string database)
+/* {{{ proto resource pg_connect(string connection_string[, int connect_type] | 
+[string host, string port [, string options [, string tty,]]] string database)
Open a PostgreSQL connection */
 PHP_FUNCTION(pg_connect)
 {
@@ -686,7 +692,7 @@
 }
 /* }}} */
 
-/* {{{ proto resource pg_pconnect([string connection_string] | [string host, string 
port [, string options [, string tty,]] string database)
+/* {{{ proto resource pg_pconnect(string connection_string | [string host, string 
+port [, string options [, string tty,]]] string database)
Open a persistent PostgreSQL connection */
 PHP_FUNCTION(pg_pconnect)
 {
Index: php4/ext/pgsql/php_pgsql.h
diff -u php4/ext/pgsql/php_pgsql.h:1.53 php4/ext/pgsql/php_pgsql.h:1.54
--- php4/ext/pgsql/php_pgsql.h:1.53 Sat Oct 12 23:00:48 2002
+++ php4/ext/pgsql/php_pgsql.h  Sun Oct 13 05:37:27 2002
@@ -17,7 +17,7 @@
+--+
  */
  
-/* $Id: php_pgsql.h,v 1.53 2002/10/13 03:00:48 yohgaki Exp $ */
+/* $Id: php_pgsql.h,v 1.54 2002/10/13 09:37:27 yohgaki Exp $ */
 
 #ifndef PHP_PGSQL_H
 #define PHP_PGSQL_H
@@ -140,6 +140,8 @@
 PHP_FUNCTION(pg_delete);
 PHP_FUNCTION(pg_select);
 
+/* connection options - ToDo: Add async connection option */
+#define PGSQL_CONNECT_FORCE_NEW (1<<1)
 /* php_pgsql_convert options */
 #define PGSQL_CONV_IGNORE_DEFAULT   (1<<1) /* Do not use DEAFULT value by 
removing field from returned array */
 #define PGSQL_CONV

[PHP-CVS] cvs: php4 /main streams.c

2002-10-13 Thread Wez Furlong

wez Fri Oct 11 22:31:43 2002 EDT

  Modified files:  
/php4/main  streams.c 
  Log:
  Write in blocks of the current chunk_size for a stream.
  Should resolve problems with network writes.
  
  
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.99 php4/main/streams.c:1.100
--- php4/main/streams.c:1.99Sun Oct  6 23:12:06 2002
+++ php4/main/streams.c Fri Oct 11 22:31:42 2002
@@ -20,7 +20,7 @@
+--+
  */
 
-/* $Id: streams.c,v 1.99 2002/10/07 03:12:06 sas Exp $ */
+/* $Id: streams.c,v 1.100 2002/10/12 02:31:42 wez Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -759,18 +759,31 @@
 
 PHPAPI size_t _php_stream_write(php_stream *stream, const char *buf, size_t count 
TSRMLS_DC)
 {
-   size_t didwrite;
+   size_t didwrite = 0, towrite, justwrote;

assert(stream);
if (buf == NULL || count == 0 || stream->ops->write == NULL)
return 0;
 
-   if (stream->filterhead) {
-   didwrite = stream->filterhead->fops->write(stream, stream->filterhead, 
buf, count TSRMLS_CC);
-   } else {
-   didwrite = stream->ops->write(stream, buf, count TSRMLS_CC);
+   while (count > 0) {
+   towrite = count;
+   if (towrite > stream->chunk_size)
+   towrite = stream->chunk_size;
+   
+   if (stream->filterhead) {
+   justwrote = stream->filterhead->fops->write(stream, 
+stream->filterhead, buf, towrite TSRMLS_CC);
+   } else {
+   justwrote = stream->ops->write(stream, buf, towrite TSRMLS_CC);
+   }
+   if (justwrote > 0) {
+   stream->position += justwrote;
+   buf += justwrote;
+   count -= justwrote;
+   didwrite += justwrote;
+   } else {
+   break;
+   }
}
-   stream->position += didwrite;
return didwrite;
 }
 



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




[PHP-CVS] Re: cvs: php4 /main php_variables.c php_variables.h

2002-10-13 Thread Yasuo Ohgaki
I get segfault with this patch during "make install"...

# It seems failed to send previous mail...
# Sorry, if you get 2 mails

--
Yasuo Ohgaki


Shane Caraveo wrote:
> shane Sun Oct 13 04:38:09 2002 EDT
> 
>   Modified files:  
> /php4/mainphp_variables.c php_variables.h 
>   Log:
>   make php_import_environment_variables overwritable so fastcgi can correctly
>   set $_ENV.
>   
>   
>   
> Index: php4/main/php_variables.c
> diff -u php4/main/php_variables.c:1.44 php4/main/php_variables.c:1.45
> --- php4/main/php_variables.c:1.44Sat Sep  7 20:27:05 2002
> +++ php4/main/php_variables.c Sun Oct 13 04:38:09 2002
> @@ -16,7 +16,7 @@
> |  Zeev Suraski <[EMAIL PROTECTED]>|
> +--+
>   */
> -/* $Id: php_variables.c,v 1.44 2002/09/08 00:27:05 yohgaki Exp $ */
> +/* $Id: php_variables.c,v 1.45 2002/10/13 08:38:09 shane Exp $ */
>  
>  #include 
>  #include "php.h"
> @@ -28,6 +28,9 @@
>  
>  #include "zend_globals.h"
>  
> +/* for systems that need to override reading of environment variables */
> +void _php_import_environment_variables(zval *array_ptr TSRMLS_DC);
> +PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC) = 
>_php_import_environment_variables;
>  
>  PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_array 
>TSRMLS_DC)
>  {
> @@ -318,8 +321,7 @@
>   }
>  }
>  
> -
> -void php_import_environment_variables(zval *array_ptr TSRMLS_DC)
> +void _php_import_environment_variables(zval *array_ptr TSRMLS_DC)
>  {
>   char **env, *p, *t;
>  
> Index: php4/main/php_variables.h
> diff -u php4/main/php_variables.h:1.13 php4/main/php_variables.h:1.14
> --- php4/main/php_variables.h:1.13Tue Dec 11 10:31:05 2001
> +++ php4/main/php_variables.h Sun Oct 13 04:38:09 2002
> @@ -17,7 +17,7 @@
> +--+
>  */
>  
> -/* $Id: php_variables.h,v 1.13 2001/12/11 15:31:05 sebastian Exp $ */
> +/* $Id: php_variables.h,v 1.14 2002/10/13 08:38:09 shane Exp $ */
>  
>  #ifndef PHP_VARIABLES_H
>  #define PHP_VARIABLES_H
> @@ -31,7 +31,7 @@
>  #define PARSE_STRING 3
>  
>  void php_treat_data(int arg, char *str, zval* destArray TSRMLS_DC);
> -PHPAPI void php_import_environment_variables(zval *array_ptr TSRMLS_DC);
> +extern PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC);
>  PHPAPI void php_register_variable(char *var, char *val, pval *track_vars_array 
>TSRMLS_DC);
>  /* binary-safe version */
>  PHPAPI void php_register_variable_safe(char *var, char *val, int val_len, pval 
>*track_vars_array TSRMLS_DC);
> 
> 



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


[PHP-CVS] cvs: php4 /sapi/cgi/libfcgi os_win32.c

2002-10-13 Thread Shane Caraveo

shane   Sun Oct 13 03:23:17 2002 EDT

  Modified files:  
/php4/sapi/cgi/libfcgi  os_win32.c 
  Log:
  fix shutdown issues
  
  
Index: php4/sapi/cgi/libfcgi/os_win32.c
diff -u php4/sapi/cgi/libfcgi/os_win32.c:1.5 php4/sapi/cgi/libfcgi/os_win32.c:1.6
--- php4/sapi/cgi/libfcgi/os_win32.c:1.5Sun Oct 13 01:55:03 2002
+++ php4/sapi/cgi/libfcgi/os_win32.cSun Oct 13 03:23:17 2002
@@ -17,7 +17,7 @@
  *  significantly more enjoyable.)
  */
 #ifndef lint
-static const char rcsid[] = "$Id: os_win32.c,v 1.5 2002/10/13 05:55:03 shane Exp $";
+static const char rcsid[] = "$Id: os_win32.c,v 1.6 2002/10/13 07:23:17 shane Exp $";
 #endif /* not lint */
 
 #define WIN32_LEAN_AND_MEAN 
@@ -271,24 +271,14 @@
 static DWORD WINAPI ShutdownRequestThread(LPVOID arg)
 {
 HANDLE shutdownEvent = (HANDLE) arg;
-
-if (WaitForSingleObject(shutdownEvent, INFINITE) == WAIT_FAILED)
-{
-// Assuming it will happen again, all we can do is exit the thread
-return 1;
-}
-else
-{
-// "Simple reads and writes to properly-aligned 32-bit variables are atomic"
-shutdownPending = TRUE;
-
-// Before an accept() is entered the shutdownPending flag is checked.
-// If set, OS_Accept() will return -1.  If not, it waits
-// on a connection request for one second, checks the flag, & repeats.
-// Only one process/thread is allowed to do this at time by
-// wrapping the accept() with mutex.
-return 0;
-}
+WaitForSingleObject(shutdownEvent, INFINITE);
+shutdownPending = TRUE;
+// Before an accept() is entered the shutdownPending flag is checked.
+// If set, OS_Accept() will return -1.  If not, it waits
+// on a connection request for one second, checks the flag, & repeats.
+// Only one process/thread is allowed to do this at time by
+// wrapping the accept() with mutex.
+return 0;
 }
 
 int OS_SetImpersonate(void)
@@ -1923,8 +1913,12 @@
 
 if (acceptMutex != INVALID_HANDLE_VALUE) 
 {
-if (WaitForSingleObject(acceptMutex, INFINITE) == WAIT_FAILED) 
+   DWORD ret;
+while ((ret = WaitForSingleObject(acceptMutex, ACCEPT_TIMEOUT)) == 
+WAIT_TIMEOUT) 
 {
+   if (shutdownPending) break;
+   }
+   if (ret == WAIT_FAILED) {
 printLastError("WaitForSingleObject() failed");
 return -1;
 }



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




[PHP-CVS] cvs: php4 /main php_variables.c php_variables.h

2002-10-13 Thread Shane Caraveo

shane   Sun Oct 13 04:38:09 2002 EDT

  Modified files:  
/php4/main  php_variables.c php_variables.h 
  Log:
  make php_import_environment_variables overwritable so fastcgi can correctly
  set $_ENV.
  
  
  
Index: php4/main/php_variables.c
diff -u php4/main/php_variables.c:1.44 php4/main/php_variables.c:1.45
--- php4/main/php_variables.c:1.44  Sat Sep  7 20:27:05 2002
+++ php4/main/php_variables.c   Sun Oct 13 04:38:09 2002
@@ -16,7 +16,7 @@
|  Zeev Suraski <[EMAIL PROTECTED]>|
+--+
  */
-/* $Id: php_variables.c,v 1.44 2002/09/08 00:27:05 yohgaki Exp $ */
+/* $Id: php_variables.c,v 1.45 2002/10/13 08:38:09 shane Exp $ */
 
 #include 
 #include "php.h"
@@ -28,6 +28,9 @@
 
 #include "zend_globals.h"
 
+/* for systems that need to override reading of environment variables */
+void _php_import_environment_variables(zval *array_ptr TSRMLS_DC);
+PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC) = 
+_php_import_environment_variables;
 
 PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_array 
TSRMLS_DC)
 {
@@ -318,8 +321,7 @@
}
 }
 
-
-void php_import_environment_variables(zval *array_ptr TSRMLS_DC)
+void _php_import_environment_variables(zval *array_ptr TSRMLS_DC)
 {
char **env, *p, *t;
 
Index: php4/main/php_variables.h
diff -u php4/main/php_variables.h:1.13 php4/main/php_variables.h:1.14
--- php4/main/php_variables.h:1.13  Tue Dec 11 10:31:05 2001
+++ php4/main/php_variables.h   Sun Oct 13 04:38:09 2002
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: php_variables.h,v 1.13 2001/12/11 15:31:05 sebastian Exp $ */
+/* $Id: php_variables.h,v 1.14 2002/10/13 08:38:09 shane Exp $ */
 
 #ifndef PHP_VARIABLES_H
 #define PHP_VARIABLES_H
@@ -31,7 +31,7 @@
 #define PARSE_STRING 3
 
 void php_treat_data(int arg, char *str, zval* destArray TSRMLS_DC);
-PHPAPI void php_import_environment_variables(zval *array_ptr TSRMLS_DC);
+extern PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC);
 PHPAPI void php_register_variable(char *var, char *val, pval *track_vars_array 
TSRMLS_DC);
 /* binary-safe version */
 PHPAPI void php_register_variable_safe(char *var, char *val, int val_len, pval 
*track_vars_array TSRMLS_DC);



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




[PHP-CVS] cvs: php4 / run-tests.php

2002-10-13 Thread Derick Rethans

derick  Sat Oct 12 15:29:57 2002 EDT

  Modified files:  
/php4   run-tests.php 
  Log:
  - woohooo! Automatic build test submits!
  
  
Index: php4/run-tests.php
diff -u php4/run-tests.php:1.68 php4/run-tests.php:1.69
--- php4/run-tests.php:1.68 Thu Oct 10 12:08:15 2002
+++ php4/run-tests.php  Sat Oct 12 15:29:56 2002
@@ -13,25 +13,22 @@
| obtain it through the world-wide-web, please send a note to  |
| [EMAIL PROTECTED] so we can mail you a copy immediately.   |
+--+
-   | Authors: Preston L. Bannister <[EMAIL PROTECTED]>   |
-   |  Sander Roobol <[EMAIL PROTECTED]>  |
+   | Authors: Ilia Alshanetsky <[EMAIL PROTECTED]> |
+   |  Preston L. Bannister <[EMAIL PROTECTED]>   |
|  Marcus Boerger <[EMAIL PROTECTED]>  |
+   |  Derick Rethans <[EMAIL PROTECTED]> |
+   |  Sander Roobol <[EMAIL PROTECTED]>  |
| (based on version by: Stig Bakken <[EMAIL PROTECTED]>) |
| (based on the PHP 3 test framework by Rasmus Lerdorf)|
+--+
  */
 
 /*
-
Require exact specification of PHP executable to test (no guessing!).
-
Die if any internal errors encountered in test script.
-
Regularized output for simpler post-processing of output.
-
Optionally output error lines indicating the failing test source and log
for direct jump with MSVC or Emacs.
-
 */
 
 /*
@@ -106,6 +103,7 @@
 $test_to_run = array();
 $test_files = array();
 $test_results = array();
+$GLOBALS['__PHP_FAILED_TESTS__'] = array();
 
 // If parameters given assume they represent selected tests to run.
 if (isset($argc) && $argc > 1) {
@@ -227,6 +225,92 @@
 =
 ";
 
+define('PHP_QA_EMAIL', '[EMAIL PROTECTED]');
+define('QA_SUBMISSION_PAGE', 'http://qa.php.net/buildtest-process.php');
+
+/* We got failed Tests, offer the user to send and e-mail to QA team */
+if ($sum_results['FAILED']) {
+   $fp = fopen("php://stdin", "r+");
+   fwrite($fp, "Some tests have failed, would you like to send the\nreport to 
+PHP's QA team? [Yn]: ");
+   fflush($fp);
+   $user_input = fgets($fp, 10);
+   
+   if (strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') {
+   /*  
+* Collect information about the host system for our report
+* Fetch phpinfo() output so that we can see the PHP enviroment
+* Make an archive of all the failed tests
+* Send an email
+*/
+   
+   $failed_tests_data = '';
+   $sep = "\n" . str_repeat('=', 80) . "\n";
+   
+   $failed_tests_data .= "Automake:\n". shell_exec('automake --version'). 
+"\n";
+   $failed_tests_data .= "Autoconf:\n". shell_exec('autoconf --version'). 
+"\n";
+   $failed_tests_data .= "Libtool:\n". shell_exec('libtool --version'). 
+"\n";
+   $failed_tests_data .= "Bison:\n". shell_exec('bison --version'). "\n";
+   $failed_tests_data .= "Compiler:\n". shell_exec('cc --version'). "\n";
+   $failed_tests_data .= "\n\n";
+   
+   foreach ($GLOBALS['__PHP_FAILED_TESTS__'] as $test_info) {
+   $failed_tests_data .= $sep . $test_info['name'];
+   $failed_tests_data .= $sep . 
+file_get_contents(realpath($test_info['output']));
+   $failed_tests_data .= $sep . 
+file_get_contents(realpath($test_info['diff']));
+   $failed_tests_data .= $sep . "\n\n";
+   }
+   
+   $failed_tests_data .= $sep . "PHPINFO" . $sep;
+   $failed_tests_data .= shell_exec($php.' -i');
+   
+   $compression = 0;
+   
+   if (!mail_qa_team($failed_tests_data, $compression)) {
+   $output_file = 'php_test_results_' . date('Ymd') . ( 
+$compression ? '.txt.gz' : '.txt' );
+   $fp = fopen($output_file, "w");
+   fwrite($fp, $failed_tests_data);
+   fclose($fp);
+   
+   echo "\nThe test script was unable to automatically send the 
+report to PHP's QA Team\nPlease send ".$output_file." to ".PHP_QA_EMAIL." manually, 
+thank you.\n";
+   } else {
+   fwrite($fp, "\nThank you for helping to make PHP better.\n");
+   fclose($fp);
+   }   
+   }
+}
+ 
+//
+// Send Email to QA Team
+//
+
+function

[PHP-CVS] cvs: php4 /sapi/thttpd config.m4

2002-10-13 Thread Sascha Schumann

sas Sun Oct 13 07:28:07 2002 EDT

  Modified files:  
/php4/sapi/thttpd   config.m4 
  Log:
  Use if block rather than an or expression
  
  
Index: php4/sapi/thttpd/config.m4
diff -u php4/sapi/thttpd/config.m4:1.15 php4/sapi/thttpd/config.m4:1.16
--- php4/sapi/thttpd/config.m4:1.15 Thu Mar  7 09:20:01 2002
+++ php4/sapi/thttpd/config.m4  Sun Oct 13 07:28:06 2002
@@ -1,11 +1,17 @@
 dnl
-dnl $Id: config.m4,v 1.15 2002/03/07 14:20:01 sas Exp $
+dnl $Id: config.m4,v 1.16 2002/10/13 11:28:06 sas Exp $
 dnl
 
 AC_ARG_WITH(thttpd,
 [  --with-thttpd=SRCDIRBuild PHP as thttpd module],[
-  test -d $withval || AC_MSG_RESULT(thttpd directory does not exist ($withval))
-  egrep thttpd.2.21b $withval/version.h >/dev/null || AC_MSG_RESULT([This version 
only supports thttpd-2.21b])
+set -x
+  if ! test -d $withval; then
+AC_MSG_RESULT(thttpd directory does not exist ($withval))
+  fi
+  if ! egrep thttpd.2.21b $withval/version.h >/dev/null; then
+AC_MSG_ERROR([This version only supports thttpd-2.21b])
+  fi
+set +x
   PHP_EXPAND_PATH($withval, THTTPD)
   PHP_TARGET_RDYNAMIC
   INSTALL_IT="\



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




[PHP-CVS] cvs: php4 /ext/standard dl.c

2002-10-13 Thread Derick Rethans

derick  Sun Oct 13 10:14:34 2002 EDT

  Modified files:  
/php4/ext/standard  dl.c 
  Log:
  - Fixed bug #19885, dl() no longer gives a fatal error when a module
could not be loaded. (Derick)
  
  
Index: php4/ext/standard/dl.c
diff -u php4/ext/standard/dl.c:1.73 php4/ext/standard/dl.c:1.74
--- php4/ext/standard/dl.c:1.73 Thu Sep  5 17:12:55 2002
+++ php4/ext/standard/dl.c  Sun Oct 13 10:14:34 2002
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: dl.c,v 1.73 2002/09/05 21:12:55 sniper Exp $ */
+/* $Id: dl.c,v 1.74 2002/10/13 14:14:34 derick Exp $ */
 
 #include "php.h"
 #include "dl.h"
@@ -66,7 +66,8 @@
 
 #ifdef ZTS
if ((strcmp(sapi_module.name, "cgi")!=0) && (strcmp(sapi_module.name, 
"cli")!=0)) {
-   php_error_docref(NULL TSRMLS_CC, E_ERROR, "Not supported in 
multithreaded Web servers - use extension statements in your php.ini");
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not supported in 
+multithreaded Web servers - use extension statements in your php.ini");
+   RETURN_FALSE;
}
 #endif
 
@@ -78,9 +79,9 @@
convert_to_string_ex(file);
 
if (!PG(enable_dl)) {
-   php_error_docref(NULL TSRMLS_CC, E_ERROR, "Dynamically loaded 
extentions aren't enabled");
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Dynamically loaded 
+extentions aren't enabled");
} else if (PG(safe_mode)) {
-   php_error_docref(NULL TSRMLS_CC, E_ERROR, "Dynamically loaded 
extensions aren't allowed when running in Safe Mode");
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Dynamically loaded 
+extensions aren't allowed when running in Safe Mode");
} else {
php_dl(*file, MODULE_TEMPORARY, return_value TSRMLS_CC);
EG(full_tables_cleanup) = 1;



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




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c php_pgsql.h

2002-10-13 Thread Yasuo Ohgaki

yohgaki Sat Oct 12 23:00:49 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c php_pgsql.h 
  Log:
  Enable pg_escape_bytea().
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.231 php4/ext/pgsql/pgsql.c:1.232
--- php4/ext/pgsql/pgsql.c:1.231Wed Oct  2 22:32:09 2002
+++ php4/ext/pgsql/pgsql.c  Sat Oct 12 23:00:47 2002
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.231 2002/10/03 02:32:09 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.232 2002/10/13 03:00:47 yohgaki Exp $ */
 
 #include 
 
@@ -142,6 +142,7 @@
 #if HAVE_PQESCAPE
PHP_FE(pg_escape_string,NULL)
PHP_FE(pg_escape_bytea, NULL)
+   PHP_FE(pg_unescape_bytea, NULL)
 #endif
 #if HAVE_PQCLIENTENCODING
PHP_FE(pg_client_encoding,  NULL)
Index: php4/ext/pgsql/php_pgsql.h
diff -u php4/ext/pgsql/php_pgsql.h:1.52 php4/ext/pgsql/php_pgsql.h:1.53
--- php4/ext/pgsql/php_pgsql.h:1.52 Wed Oct  2 22:32:09 2002
+++ php4/ext/pgsql/php_pgsql.h  Sat Oct 12 23:00:48 2002
@@ -17,7 +17,7 @@
+--+
  */
  
-/* $Id: php_pgsql.h,v 1.52 2002/10/03 02:32:09 yohgaki Exp $ */
+/* $Id: php_pgsql.h,v 1.53 2002/10/13 03:00:48 yohgaki Exp $ */
 
 #ifndef PHP_PGSQL_H
 #define PHP_PGSQL_H
@@ -129,6 +129,7 @@
 #if HAVE_PQESCAPE
 PHP_FUNCTION(pg_escape_string);
 PHP_FUNCTION(pg_escape_bytea);
+PHP_FUNCTION(pg_unescape_bytea);
 #endif
 
 /* misc functions */



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




[PHP-CVS] cvs: php4 /ext/session/tests 004.phpt 005.phpt 014.phpt 015.phpt 018.phpt 020.phpt 021.phpt

2002-10-13 Thread Derick Rethans

derick  Sun Oct 13 07:14:49 2002 EDT

  Modified files:  
/php4/ext/session/tests 004.phpt 005.phpt 014.phpt 015.phpt 
018.phpt 020.phpt 021.phpt 
  Log:
  - Hardcode dependent ini setting
  
  
Index: php4/ext/session/tests/004.phpt
diff -u php4/ext/session/tests/004.phpt:1.12 php4/ext/session/tests/004.phpt:1.13
--- php4/ext/session/tests/004.phpt:1.12Thu Oct  3 12:14:55 2002
+++ php4/ext/session/tests/004.phpt Sun Oct 13 07:14:49 2002
@@ -6,6 +6,7 @@
 session.use_cookies=0
 session.cache_limiter=
 register_globals=1
+session.name=PHPSESSID
 --FILE--
 http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /sapi/cgi/libfcgi os_unix.c

2002-10-13 Thread Shane Caraveo

shane   Sun Oct 13 04:34:27 2002 EDT

  Modified files:  
/php4/sapi/cgi/libfcgi  os_unix.c 
  Log:
  fixes for unix, untested
  remove exit calls
  fix a couple function definitions
  
  
Index: php4/sapi/cgi/libfcgi/os_unix.c
diff -u php4/sapi/cgi/libfcgi/os_unix.c:1.1 php4/sapi/cgi/libfcgi/os_unix.c:1.2
--- php4/sapi/cgi/libfcgi/os_unix.c:1.1 Sun Mar 10 16:39:28 2002
+++ php4/sapi/cgi/libfcgi/os_unix.c Sun Oct 13 04:34:27 2002
@@ -17,7 +17,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: os_unix.c,v 1.1 2002/03/10 21:39:28 shane Exp $";
+static const char rcsid[] = "$Id: os_unix.c,v 1.2 2002/10/13 08:34:27 shane Exp $";
 #endif /* not lint */
 
 #include "fcgi_config.h"
@@ -272,6 +272,7 @@
  *   on Unix for local process communication.  It will create a
  *   domain socket or a TCP/IP socket bound to "localhost" and return
  *   a file descriptor to it to the caller.
+ *   bCreateMutex is ignored for unix
  *
  * Results:
  *  Listener socket created.  This call returns either a valid
@@ -282,7 +283,7 @@
  *
  *--
  */
-int OS_CreateLocalIpcFd(const char *bindPath, int backlog)
+int OS_CreateLocalIpcFd(const char *bindPath, int backlog, int bCreateMutex)
 {
 int listenSock, servLen;
 union   SockAddrUnion sa;
@@ -311,12 +312,12 @@
  hep = gethostbyname(host);
  if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) {
fprintf(stderr, "Cannot resolve host name %s -- exiting!\n", host);
-   exit(1);
+   return -1;
  }
  if (hep->h_addr_list[1]) {
fprintf(stderr, "Host %s has multiple addresses ---\n", host);
fprintf(stderr, "you must choose one explicitly!!!\n");
-   exit(1);
+   return -1;
  }
  tcp_ia = ((struct in_addr *) (hep->h_addr))->s_addr;
}
@@ -330,7 +331,7 @@
 if(setsockopt(listenSock, SOL_SOCKET, SO_REUSEADDR,
   (char *) &flag, sizeof(flag)) < 0) {
 fprintf(stderr, "Can't set SO_REUSEADDR.\n");
-   exit(1001);
+   return -1;
}
}
 } else {
@@ -353,13 +354,13 @@
unlink(bindPath);
if(OS_BuildSockAddrUn(bindPath, &sa.unixVariant, &servLen)) {
fprintf(stderr, "Listening socket's path name is too long.\n");
-   exit(1000);
+   return -1;
}
 }
 if(bind(listenSock, (struct sockaddr *) &sa.unixVariant, servLen) < 0
|| listen(listenSock, backlog) < 0) {
perror("bind/listen");
-exit(errno);
+return -1;
 }
 
 return listenSock;
@@ -408,7 +409,7 @@
struct  hostent *hp;
if((hp = gethostbyname((*host ? host : "localhost"))) == NULL) {
fprintf(stderr, "Unknown host: %s\n", bindPath);
-   exit(1000);
+   return -1;
}
sa.inetVariant.sin_family = AF_INET;
memcpy(&sa.inetVariant.sin_addr, hp->h_addr, hp->h_length);
@@ -418,7 +419,7 @@
 } else {
if(OS_BuildSockAddrUn(bindPath, &sa.unixVariant, &servLen)) {
fprintf(stderr, "Listening socket's path name is too long.\n");
-   exit(1000);
+   return -1;
}
resultSock = socket(AF_UNIX, SOCK_STREAM, 0);
 }
@@ -497,13 +498,13 @@
  *
  *--
  */
-int OS_SpawnChild(char *appPath, int listenFd)
+int OS_SpawnChild(char *appPath, int listenFd, PROCESS_INFORMATION *pInfo, char *env)
 {
 int forkResult;
 
 forkResult = fork();
 if(forkResult < 0) {
-exit(errno);
+return -1;
 }
 
 if(forkResult == 0) {
@@ -542,7 +543,7 @@
 *
 * perror("exec");
 */
-   exit(errno);
+   return -1;
 }
 return 0;
 }
@@ -818,7 +819,9 @@
 selectStatus = select((maxFd+1), &readFdSetCpy, &writeFdSetCpy,
   NULL, tmo);
 if(selectStatus < 0) {
-exit(errno);
+/*exit(errno);*/
+   /* not sure what's best to do here */
+   return -1;
}
 
 for(fd = 0; fd <= maxFd; fd++) {
@@ -1256,10 +1259,10 @@
 {
 int val;
 if((val = fcntl(fd, F_GETFL, 0)) < 0) {
-exit(errno);
+return;
 }
 val |= flags;
 if(fcntl(fd, F_SETFL, val) < 0) {
-exit(errno);
+return;
 }
 }



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




[PHP-CVS] cvs: php4 /ext/standard info.c

2002-10-13 Thread Ilia Alshanetsky

iliaa   Fri Oct 11 23:11:29 2002 EDT

  Modified files:  
/php4/ext/standard  info.c 
  Log:
  Fixed memory leaks.
  
  
Index: php4/ext/standard/info.c
diff -u php4/ext/standard/info.c:1.216 php4/ext/standard/info.c:1.217
--- php4/ext/standard/info.c:1.216  Thu Oct 10 00:28:15 2002
+++ php4/ext/standard/info.cFri Oct 11 23:11:28 2002
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: info.c,v 1.216 2002/10/10 04:28:15 sniper Exp $ */
+/* $Id: info.c,v 1.217 2002/10/12 03:11:28 iliaa Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -99,6 +99,7 @@
char *string_key;
uint string_len;
ulong num_key;
+   char *elem_esc = NULL;
 
if (zend_hash_find(&EG(symbol_table), name, name_length+1, (void **) 
&data)!=FAILURE
&& (Z_TYPE_PP(data)==IS_ARRAY)) {
@@ -116,7 +117,9 @@
switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), 
&string_key, &string_len, &num_key, 0, NULL)) {
case HASH_KEY_IS_STRING:
if (PG(html_errors)) {
-   PUTS(php_info_html_esc(string_key 
TSRMLS_CC));
+   elem_esc = 
+php_info_html_esc(string_key TSRMLS_CC);
+   PUTS(elem_esc);
+   efree(elem_esc);
} else {
PUTS(string_key);
}   
@@ -147,7 +150,9 @@
if (Z_STRLEN(tmp2) == 0) {
PUTS("no value");
} else {
-   PUTS(php_info_html_esc(Z_STRVAL(tmp2) 
TSRMLS_CC));
+   elem_esc = 
+php_info_html_esc(Z_STRVAL(tmp2) TSRMLS_CC);
+   PUTS(elem_esc);
+   efree(elem_esc);
} 
} else {
PUTS(Z_STRVAL(tmp2));
@@ -158,7 +163,9 @@
if (Z_STRLEN_PP(tmp) == 0) {
PUTS("no value");
} else {
-   
PUTS(php_info_html_esc(Z_STRVAL_PP(tmp) TSRMLS_CC));
+   elem_esc = 
+php_info_html_esc(Z_STRVAL_PP(tmp) TSRMLS_CC);
+   PUTS(elem_esc);
+   efree(elem_esc);
}
} else {
PUTS(Z_STRVAL_PP(tmp));
@@ -713,8 +720,8 @@
int i;
va_list row_elements;
char *row_element;
+   char *elem_esc = NULL;
 /*
-   char *elem_esc;
int elem_esc_len;
 */
 
@@ -739,7 +746,9 @@
}
} else {
if (PG(html_errors)) {
-   PUTS(php_info_html_esc(row_element TSRMLS_CC));
+   elem_esc = php_info_html_esc(row_element TSRMLS_CC);
+   PUTS(elem_esc);
+   efree(elem_esc);
} else {
PUTS(row_element);
if (i < num_cols-1) {



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




[PHP-CVS] cvs: php4 /sapi/thttpd config.m4

2002-10-13 Thread Sascha Schumann

sas Sun Oct 13 07:28:34 2002 EDT

  Modified files:  
/php4/sapi/thttpd   config.m4 
  Log:
  Remove set .x
  
  
Index: php4/sapi/thttpd/config.m4
diff -u php4/sapi/thttpd/config.m4:1.16 php4/sapi/thttpd/config.m4:1.17
--- php4/sapi/thttpd/config.m4:1.16 Sun Oct 13 07:28:06 2002
+++ php4/sapi/thttpd/config.m4  Sun Oct 13 07:28:34 2002
@@ -1,17 +1,15 @@
 dnl
-dnl $Id: config.m4,v 1.16 2002/10/13 11:28:06 sas Exp $
+dnl $Id: config.m4,v 1.17 2002/10/13 11:28:34 sas Exp $
 dnl
 
 AC_ARG_WITH(thttpd,
 [  --with-thttpd=SRCDIRBuild PHP as thttpd module],[
-set -x
   if ! test -d $withval; then
 AC_MSG_RESULT(thttpd directory does not exist ($withval))
   fi
   if ! egrep thttpd.2.21b $withval/version.h >/dev/null; then
 AC_MSG_ERROR([This version only supports thttpd-2.21b])
   fi
-set +x
   PHP_EXPAND_PATH($withval, THTTPD)
   PHP_TARGET_RDYNAMIC
   INSTALL_IT="\



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




[PHP-CVS] cvs: php4 /ext/standard url.c

2002-10-13 Thread Ilia Alshanetsky

iliaa   Sat Oct 12 12:09:01 2002 EDT

  Modified files:  
/php4/ext/standard  url.c 
  Log:
  Fixed a bug introduced by previous patch.
  
  
Index: php4/ext/standard/url.c
diff -u php4/ext/standard/url.c:1.54 php4/ext/standard/url.c:1.55
--- php4/ext/standard/url.c:1.54Sat Oct 12 04:16:20 2002
+++ php4/ext/standard/url.c Sat Oct 12 12:09:01 2002
@@ -15,7 +15,7 @@
| Author: Jim Winstead <[EMAIL PROTECTED]>  |
+--+
  */
-/* $Id: url.c,v 1.54 2002/10/12 08:16:20 sesser Exp $ */
+/* $Id: url.c,v 1.55 2002/10/12 16:09:01 iliaa Exp $ */
 
 #include 
 #include 
@@ -132,8 +132,8 @@
php_replace_controlchars(ret->user);
}   

-   if (p-pp > 1) {
-   p++;
+   pp++;
+   if (p-pp > 0) {
ret->pass = estrndup(pp, (p-pp));
php_replace_controlchars(ret->pass);
}   



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