[PHP-CVS] cvs: php-src(PHP_4_3) /main main.c

2003-10-01 Thread Andrei Zmievski
andrei  Wed Oct  1 17:24:20 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/main   main.c 
  Log:
  @- Made $argc and $argv always available as globals in CLI. No more
  @  silliness. (Andrei)
  
  
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.512.2.47 php-src/main/main.c:1.512.2.48
--- php-src/main/main.c:1.512.2.47  Wed Sep 24 19:22:32 2003
+++ php-src/main/main.c Wed Oct  1 17:24:19 2003
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: main.c,v 1.512.2.47 2003/09/24 23:22:32 iliaa Exp $ */
+/* $Id: main.c,v 1.512.2.48 2003/10/01 21:24:19 andrei Exp $ */
 
 /* {{{ includes
  */
@@ -1316,11 +1316,6 @@
sapi_module.register_server_variables(array_ptr TSRMLS_CC);
}
 
-   /* argv/argc support */
-   if (PG(register_argc_argv)) {
-   php_build_argv(SG(request_info).query_string TSRMLS_CC);
-   }
-
/* PHP Authentication support */
if (SG(request_info).auth_user) {
php_register_variable("PHP_AUTH_USER", SG(request_info).auth_user, 
array_ptr TSRMLS_CC);
@@ -1482,6 +1477,11 @@
}
}
 
+   /* argv/argc support */
+   if (PG(register_argc_argv)) {
+   php_build_argv(SG(request_info).query_string TSRMLS_CC);
+   }
+
for (i=0; iis_ref = 0;
 
/* Prepare argv */
if (SG(request_info).argc) { /* are we in cli sapi? */
@@ -1605,7 +1610,7 @@
Z_LVAL_P(argc) = count;
}
Z_TYPE_P(argc) = IS_LONG;
-   INIT_PZVAL(argc);
+   argc->is_ref = 0;
 
if (PG(register_globals) || SG(request_info).argc) {
arr->refcount++;
@@ -1614,7 +1619,9 @@
zend_hash_add(&EG(symbol_table), "argc", sizeof("argc"), &argc, 
sizeof(zval *), NULL);
}
 
-   if ( PG(http_globals)[TRACK_VARS_SERVER] != NULL ) {
+   if (PG(http_globals)[TRACK_VARS_SERVER] != NULL) {
+   arr->refcount++;
+   argc->refcount++;
zend_hash_update(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), 
"argv", sizeof("argv"), &arr, sizeof(pval *), NULL);
zend_hash_update(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), 
"argc", sizeof("argc"), &argc, sizeof(pval *), NULL);
}

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



[PHP-CVS] cvs: php-src /main php_variables.c

2003-10-01 Thread Andrei Zmievski
andrei  Wed Oct  1 19:12:01 2003 EDT

  Modified files:  
/php-src/main   php_variables.c 
  Log:
  Made the $argc and $argv always available as globals in CLI, and not as
  $_SERVER vars which depended on variables_order anyway. No more
  silliness.
  
  
Index: php-src/main/php_variables.c
diff -u php-src/main/php_variables.c:1.68 php-src/main/php_variables.c:1.69
--- php-src/main/php_variables.c:1.68   Thu Jul 31 18:56:57 2003
+++ php-src/main/php_variables.cWed Oct  1 19:11:59 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: php_variables.c,v 1.68 2003/07/31 22:56:57 iliaa Exp $ */
+/* $Id: php_variables.c,v 1.69 2003/10/01 23:11:59 andrei Exp $ */
 
 #include 
 #include "php.h"
@@ -369,9 +369,15 @@
int count = 0;
char *ss, *space;

+   if (! (PG(register_globals) || SG(request_info).argc ||
+  PG(http_globals)[TRACK_VARS_SERVER]) ) {
+   return;
+   }
+   
ALLOC_ZVAL(arr);
array_init(arr);
-   INIT_PZVAL(arr);
+   arr->is_ref = 0;
+   arr->refcount = 0;
 
/* Prepare argv */
if (SG(request_info).argc) { /* are we in cli sapi? */
@@ -424,17 +430,20 @@
Z_LVAL_P(argc) = count;
}
Z_TYPE_P(argc) = IS_LONG;
-   INIT_PZVAL(argc);
+   argc->is_ref = 0;
+   argc->refcount = 0;
 
if (PG(register_globals) || SG(request_info).argc) {
arr->refcount++;
argc->refcount++;
zend_hash_update(&EG(symbol_table), "argv", sizeof("argv"), &arr, 
sizeof(zval *), NULL);
zend_hash_add(&EG(symbol_table), "argc", sizeof("argc"), &argc, 
sizeof(zval *), NULL);
+   } else if (!SG(request_info).argc) {
+   arr->refcount++;
+   argc->refcount++;
+   zend_hash_update(Z_ARRVAL_P(track_vars_array), "argv", sizeof("argv"), 
&arr, sizeof(pval *), NULL);
+   zend_hash_update(Z_ARRVAL_P(track_vars_array), "argc", sizeof("argc"), 
&argc, sizeof(pval *), NULL);
}
-
-   zend_hash_update(Z_ARRVAL_P(track_vars_array), "argv", sizeof("argv"), &arr, 
sizeof(pval *), NULL);
-   zend_hash_update(Z_ARRVAL_P(track_vars_array), "argc", sizeof("argc"), &argc, 
sizeof(pval *), NULL);
 }
 /* }}} */
 
@@ -476,11 +485,6 @@
sapi_module.register_server_variables(array_ptr TSRMLS_CC);
}
 
-   /* argv/argc support */
-   if (PG(register_argc_argv)) {
-   php_build_argv(SG(request_info).query_string, array_ptr TSRMLS_CC);
-   }
-
/* PHP Authentication support */
if (SG(request_info).auth_user) {
php_register_variable("PHP_AUTH_USER", SG(request_info).auth_user, 
array_ptr TSRMLS_CC);
@@ -644,6 +648,11 @@
if (PG(register_globals)) {
php_autoglobal_merge(&EG(symbol_table), 
Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]) TSRMLS_CC);
}
+   }
+
+   /* argv/argc support */
+   if (PG(register_argc_argv)) {
+   php_build_argv(SG(request_info).query_string, 
PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
}
 
for (i=0; ihttp://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_4_3) /main main.c

2003-10-01 Thread Andrei Zmievski
andrei  Wed Oct  1 19:13:05 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-src/main   main.c 
  Log:
  Make sure to clear out the refcount.
  
  
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.512.2.48 php-src/main/main.c:1.512.2.49
--- php-src/main/main.c:1.512.2.48  Wed Oct  1 17:24:19 2003
+++ php-src/main/main.c Wed Oct  1 19:13:04 2003
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: main.c,v 1.512.2.48 2003/10/01 21:24:19 andrei Exp $ */
+/* $Id: main.c,v 1.512.2.49 2003/10/01 23:13:04 andrei Exp $ */
 
 /* {{{ includes
  */
@@ -1558,6 +1558,7 @@
ALLOC_ZVAL(arr);
array_init(arr);
arr->is_ref = 0;
+   arr->refcount = 0;
 
/* Prepare argv */
if (SG(request_info).argc) { /* are we in cli sapi? */
@@ -1611,6 +1612,7 @@
}
Z_TYPE_P(argc) = IS_LONG;
argc->is_ref = 0;
+   argc->refcount = 0;
 
if (PG(register_globals) || SG(request_info).argc) {
arr->refcount++;

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



[PHP-CVS] cvs: php-src / acinclude.m4

2003-10-01 Thread Jani Taskinen
sniper  Wed Oct  1 20:35:09 2003 EDT

  Modified files:  
/php-srcacinclude.m4 
  Log:
  Should fix bug #25719
  
Index: php-src/acinclude.m4
diff -u php-src/acinclude.m4:1.262 php-src/acinclude.m4:1.263
--- php-src/acinclude.m4:1.262  Tue Sep 30 14:08:12 2003
+++ php-src/acinclude.m4Wed Oct  1 20:35:09 2003
@@ -1,4 +1,4 @@
-dnl $Id: acinclude.m4,v 1.262 2003/09/30 18:08:12 sniper Exp $
+dnl $Id: acinclude.m4,v 1.263 2003/10/02 00:35:09 sniper Exp $
 dnl
 dnl This file contains local autoconf functions.
 
@@ -1617,6 +1617,7 @@
   if test -r $i/lib/libssl.a -o -r $i/lib/libssl.$SHLIB_SUFFIX_NAME; then
 OPENSSL_LIBDIR=$i/lib
   fi
+  test -n "$OPENSSL_INCDIR" && test -n "$OPENSSL_LIBDIR" && break
 done
 
 if test -z "$OPENSSL_INCDIR"; then
@@ -1645,12 +1646,12 @@
 PHP_CHECK_LIBRARY(crypto, CRYPTO_free, [
   PHP_CHECK_LIBRARY(ssl, SSL_CTX_set_ssl_version, [
 found_openssl=yes
-OPENSSL_LIBS=-L$OPENSSL_LIBDIR -lcrypto -lssl
+OPENSSL_LIBS="-L$OPENSSL_LIBDIR -lssl -lcrypto"
 OPENSSL_INCS=-I$OPENSSL_INCDIR
   ], [
 AC_MSG_ERROR([libssl not found!])
   ],[
--L$OPENSSL_LIBDIR -lcrypto
+-L$OPENSSL_LIBDIR -lssl -lcrypto
   ])
 ], [
   AC_MSG_ERROR([libcrypto not found!])

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



[PHP-CVS] cvs: php-src(PHP_4_3) / acinclude.m4

2003-10-01 Thread Jani Taskinen
sniper  Wed Oct  1 20:35:32 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-srcacinclude.m4 
  Log:
  MFH: fix for bug #25719
  
Index: php-src/acinclude.m4
diff -u php-src/acinclude.m4:1.218.2.29 php-src/acinclude.m4:1.218.2.30
--- php-src/acinclude.m4:1.218.2.29 Tue Sep 30 14:08:57 2003
+++ php-src/acinclude.m4Wed Oct  1 20:35:31 2003
@@ -1,4 +1,4 @@
-dnl $Id: acinclude.m4,v 1.218.2.29 2003/09/30 18:08:57 sniper Exp $
+dnl $Id: acinclude.m4,v 1.218.2.30 2003/10/02 00:35:31 sniper Exp $
 dnl
 dnl This file contains local autoconf functions.
 
@@ -1623,6 +1623,7 @@
   if test -r $i/lib/libssl.a -o -r $i/lib/libssl.$SHLIB_SUFFIX_NAME; then
 OPENSSL_LIBDIR=$i/lib
   fi
+  test -n "$OPENSSL_INCDIR" && test -n "$OPENSSL_LIBDIR" && break
 done
 
 if test -z "$OPENSSL_INCDIR"; then
@@ -1651,12 +1652,12 @@
 PHP_CHECK_LIBRARY(crypto, CRYPTO_free, [
   PHP_CHECK_LIBRARY(ssl, SSL_CTX_set_ssl_version, [
 found_openssl=yes
-OPENSSL_LIBS=-L$OPENSSL_LIBDIR -lcrypto -lssl
+OPENSSL_LIBS="-L$OPENSSL_LIBDIR -lssl -lcrypto"
 OPENSSL_INCS=-I$OPENSSL_INCDIR
   ], [
 AC_MSG_ERROR([libssl not found!])
   ],[
--L$OPENSSL_LIBDIR -lcrypto
+-L$OPENSSL_LIBDIR -lssl -lcrypto
   ])
 ], [
   AC_MSG_ERROR([libcrypto not found!])

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



[PHP-CVS] cvs: php-src /sapi/apache2handler sapi_apache2.c

2003-10-01 Thread Ilia Alshanetsky
iliaa   Wed Oct  1 23:24:37 2003 EDT

  Modified files:  
/php-src/sapi/apache2handlersapi_apache2.c 
  Log:
  Fixed bug #25701 (On flush() set headers_sent in apache2handler)
  
  
  
Index: php-src/sapi/apache2handler/sapi_apache2.c
diff -u php-src/sapi/apache2handler/sapi_apache2.c:1.27 
php-src/sapi/apache2handler/sapi_apache2.c:1.28
--- php-src/sapi/apache2handler/sapi_apache2.c:1.27 Thu Sep 18 20:44:50 2003
+++ php-src/sapi/apache2handler/sapi_apache2.c  Wed Oct  1 23:24:36 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: sapi_apache2.c,v 1.27 2003/09/19 00:44:50 iliaa Exp $ */
+/* $Id: sapi_apache2.c,v 1.28 2003/10/02 03:24:36 iliaa Exp $ */
 
 #include 
 
@@ -257,6 +257,7 @@
brigade = ctx->brigade;
 
r->status = SG(sapi_headers).http_response_code;
+   SG(headers_sent) = 1;
 
/* Send a flush bucket down the filter chain. */
bucket = apr_bucket_flush_create(r->connection->bucket_alloc);

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



[PHP-CVS] cvs: php-src(PHP_4_3) / NEWS /sapi/apache2handler sapi_apache2.c

2003-10-01 Thread Ilia Alshanetsky
iliaa   Wed Oct  1 23:24:44 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-srcNEWS 
/php-src/sapi/apache2handlersapi_apache2.c 
  Log:
  MFH: Fixed bug #25701 (On flush() set headers_sent in apache2handler)
  
  
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.415 php-src/NEWS:1.1247.2.416
--- php-src/NEWS:1.1247.2.415   Tue Sep 30 14:08:57 2003
+++ php-src/NEWSWed Oct  1 23:24:42 2003
@@ -2,6 +2,7 @@
 |||
 ?? Oct 2003, Version 4.3.4RC2
 - Fixed bug #25703 (openssl checks failed). (Jani)
+- Fixed bug #25701 (On flush() set headers_sent in apache2handler). (Ilia)
 - Fixed bug #25669 (eregi() with non-ascii characters). (Moriyoshi)
 
 29 Sep 2003, Version 4.3.4RC1
Index: php-src/sapi/apache2handler/sapi_apache2.c
diff -u php-src/sapi/apache2handler/sapi_apache2.c:1.1.2.22 
php-src/sapi/apache2handler/sapi_apache2.c:1.1.2.23
--- php-src/sapi/apache2handler/sapi_apache2.c:1.1.2.22 Thu Sep 18 20:44:58 2003
+++ php-src/sapi/apache2handler/sapi_apache2.c  Wed Oct  1 23:24:43 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: sapi_apache2.c,v 1.1.2.22 2003/09/19 00:44:58 iliaa Exp $ */
+/* $Id: sapi_apache2.c,v 1.1.2.23 2003/10/02 03:24:43 iliaa Exp $ */
 
 #include 
 
@@ -262,6 +262,7 @@
brigade = ctx->brigade;
 
r->status = SG(sapi_headers).http_response_code;
+   SG(headers_sent) = 1;
 
/* Send a flush bucket down the filter chain. */
bucket = apr_bucket_flush_create(r->connection->bucket_alloc);

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



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

2003-10-01 Thread Moriyoshi Koizumi
moriyoshi   Thu Oct  2 02:57:22 2003 EDT

  Added files: 
/php-src/ext/standard/tests/strings bug25707.phpt 

  Modified files:  
/php-src/ext/standard   html.c 
  Log:
  Fixed bug #25707 (html_entity_decode over-decodes <)
  
  
Index: php-src/ext/standard/html.c
diff -u php-src/ext/standard/html.c:1.86 php-src/ext/standard/html.c:1.87
--- php-src/ext/standard/html.c:1.86Tue Jun 10 16:03:37 2003
+++ php-src/ext/standard/html.c Thu Oct  2 02:57:21 2003
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: html.c,v 1.86 2003/06/10 20:03:37 imajes Exp $ */
+/* $Id: html.c,v 1.87 2003/10/02 06:57:21 moriyoshi Exp $ */
 
 /*
  * HTML entity resources:
@@ -417,7 +417,6 @@
int entitylen;
int flags;
 } basic_entities[] = {
-   { '&',  "&",5,  0 },
{ '"',  """,   6,  ENT_HTML_QUOTE_DOUBLE },
{ '\'', "'",   6,  ENT_HTML_QUOTE_SINGLE },
{ '\'', "'",5,  ENT_HTML_QUOTE_SINGLE },
@@ -917,54 +916,69 @@
ret = replaced;
}
 
-   /* replace numeric entities */
+   /* replace numeric entities & "&" */
lim = ret + retlen;
-   for (p = ret, q = ret; p < lim; p++) {
+   for (p = ret, q = ret; p < lim;) {
int code;
 
-   if (p < lim - 1 && p[0] == '&' && p[1] == '#') {
-   code = strtol(p + 2, &next, 10);
-   if (next != NULL && *next == ';') {
-   switch (charset) {
-   case cs_utf_8:
-   q += php_utf32_utf8(q, code);
-   break;
+   if (p[0] == '&') {
+   if (p + 2 < lim) {
+   if (p[1] == '#') {
+   code = strtol(p + 2, &next, 10);
+   if (next != NULL && *next == ';') {
+   switch (charset) {
+   case cs_utf_8:
+   q += php_utf32_utf8(q, 
code);
+   break;
 
-   case cs_8859_1:
-   case cs_8859_5:
-   case cs_8859_15:
-   if (0xa0 <= code && code <= 0xff) {
-   *(q++) = code;
-   }
-   break;
+   case cs_8859_1:
+   case cs_8859_5:
+   case cs_8859_15:
+   if (0xa0 <= code && 
code <= 0xff) {
+   *(q++) = code;
+   }
+   break;
 
-   case cs_cp1252:
-   case cs_cp1251:
-   case cs_cp866:
-   if (0x80 <= code && code <= 0xff) {
-   *(q++) = code;
-   }
-   break;
+   case cs_cp1252:
+   case cs_cp1251:
+   case cs_cp866:
+   if (0x80 <= code && 
code <= 0xff) {
+   *(q++) = code;
+   }
+   break;
 
-   case cs_big5:
-   case cs_gb2312:
-   case cs_big5hkscs:
-   case cs_sjis:
-   case cs_eucjp:
-   if (code <= 0x7f) {
-   *(q++) = code;
-   }
-   break;
+   case cs_big5:
+   case cs_gb2312:
+