Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/odbc php_odbc.c php_odbc.h php_odbc_includes.h

2008-09-02 Thread Jani Taskinen

Patrick van Kleef wrote:
I have merged these fixes to HEAD, PHP5_3 and PHP5_2 branch as per your 
request.


Jani: Please move the NEWS item fixes to PHP5_2 so i can see how you 
want this committed for future reference.


Done.

I will start looking at the registered ODBC bugs in the system to see 
what problems there are and how they can be fixed. However this will not 
all happen today ;)


You should watch your coding style and whitespace pollution.
f.e. whitespace: we only use tabs. And control structures, use { } 
generously, shortening stuff like 'if (foo) bar;' is not the way to go..

(not saying you did that, just FYI :)

And "splitting" lines: If you have to do that: Get a bigger screen!
(short: don't do it)

--Jani


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



[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /main main.c /tests/lang bug43958.phpt

2008-09-02 Thread Dmitry Stogov
dmitry  Tue Sep  2 09:45:36 2008 UTC

  Added files: (Branch: PHP_5_2)
/php-src/tests/lang bug43958.phpt 

  Modified files:  
/php-srcNEWS 
/php-src/main   main.c 
  Log:
  Fixed Bug #43958 (class name added into the error message)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1210&r2=1.2027.2.547.2.1211&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1210 php-src/NEWS:1.2027.2.547.2.1211
--- php-src/NEWS:1.2027.2.547.2.1210Tue Sep  2 08:58:00 2008
+++ php-src/NEWSTue Sep  2 09:45:36 2008
@@ -87,6 +87,7 @@
   (Jani)
 - Fixed bug #43993 (mb_substr_count() behaves differently to substr_count() 
with
   overlapping needles). (Moriyoshi)
+- Fixed Bug #43958 (class name added into the error message). (Dmitry)
 - Fixed bug #43941 (json_encode silently cuts non-UTF8 strings). (Stas)
 - Fixed bug #43782 (feof() does not detect timeout on socket). (David Soria 
Parra)
 - Fixed bug #43668 (Added odbc.default_cursortype to control the ODBC
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.65&r2=1.640.2.23.2.66&diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.640.2.23.2.65 php-src/main/main.c:1.640.2.23.2.66
--- php-src/main/main.c:1.640.2.23.2.65 Tue Aug 26 23:26:27 2008
+++ php-src/main/main.c Tue Sep  2 09:45:36 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: main.c,v 1.640.2.23.2.65 2008/08/26 23:26:27 jani Exp $ */
+/* $Id: main.c,v 1.640.2.23.2.66 2008/09/02 09:45:36 dmitry Exp $ */
 
 /* {{{ includes
  */
@@ -568,8 +568,8 @@
char *docref_target = "", *docref_root = "";
char *p;
int buffer_len = 0;
-   char *space;
-   char *class_name = get_active_class_name(&space TSRMLS_CC);
+   char *space = "";
+   char *class_name = "";
char *function;
int origin_len;
char *origin;
@@ -625,6 +625,7 @@
function = "Unknown";
} else {
is_function = 1;
+   class_name = get_active_class_name(&space TSRMLS_CC);
}
}
 

http://cvs.php.net/viewvc.cgi/php-src/tests/lang/bug43958.phpt?view=markup&rev=1.1
Index: php-src/tests/lang/bug43958.phpt
+++ php-src/tests/lang/bug43958.phpt



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



[PHP-CVS] cvs: php-src(PHP_5_3) /main main.c /tests/lang bug43958.phpt

2008-09-02 Thread Dmitry Stogov
dmitry  Tue Sep  2 09:45:49 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/tests/lang bug43958.phpt 

  Modified files:  
/php-src/main   main.c 
  Log:
  Fixed Bug #43958 (class name added into the error message)
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.57.2.32&r2=1.640.2.23.2.57.2.33&diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.640.2.23.2.57.2.32 
php-src/main/main.c:1.640.2.23.2.57.2.33
--- php-src/main/main.c:1.640.2.23.2.57.2.32Tue Aug 26 23:26:07 2008
+++ php-src/main/main.c Tue Sep  2 09:45:49 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: main.c,v 1.640.2.23.2.57.2.32 2008/08/26 23:26:07 jani Exp $ */
+/* $Id: main.c,v 1.640.2.23.2.57.2.33 2008/09/02 09:45:49 dmitry Exp $ */
 
 /* {{{ includes
  */
@@ -575,8 +575,8 @@
char *docref_target = "", *docref_root = "";
char *p;
int buffer_len = 0;
-   char *space;
-   char *class_name = get_active_class_name(&space TSRMLS_CC);
+   char *space = "";
+   char *class_name = "";
char *function;
int origin_len;
char *origin;
@@ -632,6 +632,7 @@
function = "Unknown";
} else {
is_function = 1;
+   class_name = get_active_class_name(&space TSRMLS_CC);
}
}
 

http://cvs.php.net/viewvc.cgi/php-src/tests/lang/bug43958.phpt?view=markup&rev=1.1
Index: php-src/tests/lang/bug43958.phpt
+++ php-src/tests/lang/bug43958.phpt



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



[PHP-CVS] cvs: php-src /main main.c /tests/lang bug43958.phpt

2008-09-02 Thread Dmitry Stogov
dmitry  Tue Sep  2 09:46:00 2008 UTC

  Modified files:  
/php-src/main   main.c 
/php-src/tests/lang bug43958.phpt 
  Log:
  Fixed Bug #43958 (class name added into the error message)
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.783&r2=1.784&diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.783 php-src/main/main.c:1.784
--- php-src/main/main.c:1.783   Tue Aug 26 23:25:40 2008
+++ php-src/main/main.c Tue Sep  2 09:46:00 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: main.c,v 1.783 2008/08/26 23:25:40 jani Exp $ */
+/* $Id: main.c,v 1.784 2008/09/02 09:46:00 dmitry Exp $ */
 
 /* {{{ includes
  */
@@ -668,8 +668,8 @@
char *docref_target = "", *docref_root = "";
char *p;
int buffer_len = 0;
-   char *space;
-   zstr class_name = get_active_class_name(&space TSRMLS_CC);
+   char *space = "";
+   zstr class_name = EMPTY_ZSTR;
int origin_len;
zstr function = NULL_ZSTR;
char *origin;
@@ -721,6 +721,8 @@
if (!function.v || !USTR_LEN(function)) {
stage = "Unknown";
function.v = NULL;
+   } else {
+   class_name = get_active_class_name(&space TSRMLS_CC);
}
}
 
http://cvs.php.net/viewvc.cgi/php-src/tests/lang/bug43958.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/tests/lang/bug43958.phpt
diff -u /dev/null php-src/tests/lang/bug43958.phpt:1.2
--- /dev/null   Tue Sep  2 09:46:00 2008
+++ php-src/tests/lang/bug43958.phptTue Sep  2 09:46:00 2008
@@ -0,0 +1,17 @@
+--TEST--
+Bug #43958 (class name added into the error message)
+--FILE--
+http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/fileinfo fileinfo.c /ext/fileinfo/libmagic magic.c /ext/fileinfo/tests finfo_file_001.phpt

2008-09-02 Thread Pierre-Alain Joye
pajoye  Tue Sep  2 10:15:55 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/fileinfo   fileinfo.c 
/php-src/ext/fileinfo/libmagic  magic.c 
/php-src/ext/fileinfo/tests finfo_file_001.phpt 
  Log:
  - don't close caller streams in libmagic (prevent leak and zombie stream)
  - string returned by magic_* are freed on magic_close, duplicate before
calling magic_close (set return value)
  - if stat failed, don't try to call magic_* (when FILEINFO_MODE_FILE)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/fileinfo.c?r1=1.20.2.11&r2=1.20.2.12&diff_format=u
Index: php-src/ext/fileinfo/fileinfo.c
diff -u php-src/ext/fileinfo/fileinfo.c:1.20.2.11 
php-src/ext/fileinfo/fileinfo.c:1.20.2.12
--- php-src/ext/fileinfo/fileinfo.c:1.20.2.11   Mon Sep  1 23:44:00 2008
+++ php-src/ext/fileinfo/fileinfo.c Tue Sep  2 10:15:54 2008
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: fileinfo.c,v 1.20.2.11 2008/09/01 23:44:00 felipe Exp $ */
+/* $Id: fileinfo.c,v 1.20.2.12 2008/09/02 10:15:54 pajoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -452,10 +452,8 @@
magic = magic_open(MAGIC_MIME);
if (magic_load(magic, NULL) == -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to 
load magic database.");
-   magic_close(magic);
-   RETURN_FALSE;
+   goto common;
}
-
} else if (object) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lr", 
&buffer, &buffer_len, &options, &zcontext) == FAILURE) {
RETURN_FALSE;
@@ -508,12 +506,19 @@
 
if (buffer == NULL || !*buffer) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Empty filename or path");
-   RETURN_FALSE;
+   RETVAL_FALSE;
+   goto clean;
}
 
-   if (php_sys_stat(buffer, &sb) == 0 && (sb.st_mode & 
_S_IFDIR)) {
-   ret_val = mime_directory;
-   goto common;
+   if (php_sys_stat(buffer, &sb) == 0) {
+ if (sb.st_mode & _S_IFDIR) {
+ret_val = 
mime_directory;
+goto common;
+ }
+   } else {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"File or path not found '%s'", buffer);
+   RETVAL_FALSE;
+   goto clean;
}
 
wrap = php_stream_locate_url_wrapper(buffer, &tmp2, 0 
TSRMLS_CC);
@@ -524,10 +529,8 @@
php_stream *stream = 
php_stream_open_wrapper_ex(buffer, "rb", ENFORCE_SAFE_MODE | REPORT_ERRORS, 
NULL, context);
 
if (!stream) {
-   if (mimetype_emu) {
-   magic_close(magic);
-   }
-   RETURN_FALSE;
+   RETVAL_FALSE;
+   goto clean;
}
 
ret_val = magic_stream(magic, stream);
@@ -538,27 +541,26 @@
 
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only 
process string or stream arguments");
-   RETURN_FALSE;
}
 
 common:
+   if (ret_val) {
+   RETVAL_STRING(ret_val, 1);
+   } else {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed identify 
data %d:%s", magic_errno(magic), magic_error(magic));
+   RETVAL_FALSE;
+   }
+
+clean:
if (mimetype_emu) {
-   if (magic) {
-   magic_close(magic);
-   }
+   magic_close(magic);
}
 
/* Restore options */
if (options) {
FINFO_SET_OPTION(magic, finfo->options)
}
-
-   if (!ret_val) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed identify 
data %d:%s", magic_errno(magic), magic_error(magic));
-   RETURN_FALSE;
-   } else {
-   RETURN_STRING(ret_val, 1);
-   }
+   return;
 }
 /* }}} */
 
http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/libmagic/magic.c?r1=1.1.2.3&r2=1.1.2.4&diff_format=u
Index: php-src/ext/fileinfo/libmagic/magic.c
diff -u php-src/ext/fileinfo/libmagic/magic.c:1.1.2.3 
php-src/ext/fileinfo/libmagic/magic.c:1.1.2.4
--- php-src/ext/fileinfo/libmagic/magic.c

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/fileinfo/tests mime_content_type_001.phpt

2008-09-02 Thread Pierre-Alain Joye
pajoye  Tue Sep  2 10:28:11 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/fileinfo/tests mime_content_type_001.phpt 
  Log:
  - fix test (file or path not found) (Thanks Dmitry for the notice)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/tests/mime_content_type_001.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: php-src/ext/fileinfo/tests/mime_content_type_001.phpt
diff -u php-src/ext/fileinfo/tests/mime_content_type_001.phpt:1.1.2.2 
php-src/ext/fileinfo/tests/mime_content_type_001.phpt:1.1.2.3
--- php-src/ext/fileinfo/tests/mime_content_type_001.phpt:1.1.2.2   Mon Sep 
 1 23:44:00 2008
+++ php-src/ext/fileinfo/tests/mime_content_type_001.phpt   Tue Sep  2 
10:28:11 2008
@@ -21,7 +21,7 @@
 
 Warning: mime_content_type(): Can only process string or stream arguments in 
%s on line %d
 
-Warning: mime_content_type(foo/inexistent): failed to open stream: No such 
file or directory in %s on line %d
+Warning: mime_content_type(): File or path not found 'foo/inexistent' in %s on 
line %d
 
 Warning: mime_content_type(): Empty filename or path in %s on line %d
 



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/fileinfo/libmagic apprentice.c

2008-09-02 Thread Felipe Pena
felipe  Tue Sep  2 12:43:24 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/fileinfo/libmagic  apprentice.c 
  Log:
  - Silent valgrind
  
http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/libmagic/apprentice.c?r1=1.7.2.4&r2=1.7.2.5&diff_format=u
Index: php-src/ext/fileinfo/libmagic/apprentice.c
diff -u php-src/ext/fileinfo/libmagic/apprentice.c:1.7.2.4 
php-src/ext/fileinfo/libmagic/apprentice.c:1.7.2.5
--- php-src/ext/fileinfo/libmagic/apprentice.c:1.7.2.4  Mon Sep  1 18:56:06 2008
+++ php-src/ext/fileinfo/libmagic/apprentice.c  Tue Sep  2 12:43:24 2008
@@ -1894,6 +1894,7 @@
ret = 1;
 
php_stream_close(stream);
+   stream = NULL;
 
 internal_loaded:
*magicp = mm;



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



[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /sapi/cgi cgi_main.c /sapi/cgi/tests 010.phpt

2008-09-02 Thread Dmitry Stogov
dmitry  Tue Sep  2 13:22:00 2008 UTC

  Added files: (Branch: PHP_5_2)
/php-src/sapi/cgi/tests 010.phpt 

  Modified files:  
/php-srcNEWS 
/php-src/sapi/cgi   cgi_main.c 
  Log:
  Fixed bug #45860 (header() function fails to correctly replace all Status 
lines)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1211&r2=1.2027.2.547.2.1212&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1211 php-src/NEWS:1.2027.2.547.2.1212
--- php-src/NEWS:1.2027.2.547.2.1211Tue Sep  2 09:45:36 2008
+++ php-src/NEWSTue Sep  2 13:21:59 2008
@@ -23,6 +23,8 @@
   in parsed file). (Jani)
 - Fixed bug #45862 (get_class_vars is inconsistent with 'protected' and 
   'private' variables). (ilewis at uk dot ibm dot com, Felipe)
+- Fixed bug #45860 (header() function fails to correctly replace all Status
+  lines). (Dmitry)
 - Fixed bug #45805 (Crash on throwing exception from error handler). (Dmitry)
 - Fixed bug #45765 (ReflectionObject with default parameters of self::xxx cause
   an error). (Felipe)
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.60&r2=1.267.2.15.2.61&diff_format=u
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.60 
php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.61
--- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.60 Fri Aug 15 07:30:31 2008
+++ php-src/sapi/cgi/cgi_main.c Tue Sep  2 13:22:00 2008
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.267.2.15.2.60 2008/08/15 07:30:31 dmitry Exp $ */
+/* $Id: cgi_main.c,v 1.267.2.15.2.61 2008/09/02 13:22:00 dmitry Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -369,6 +369,7 @@
char buf[SAPI_CGI_MAX_HEADER_LENGTH];
sapi_header_struct *h;
zend_llist_position pos;
+   zend_bool ignore_status = 0;
 
if (SG(request_info).no_headers == 1) {
return  SAPI_HEADER_SENT_SUCCESSFULLY;
@@ -424,6 +425,7 @@
}
if (!has_status) {
PHPWRITE_H(buf, len);
+   ignore_status = 1;
}
}
 
@@ -431,8 +433,17 @@
while (h) {
/* prevent CRLFCRLF */
if (h->header_len) {
-   PHPWRITE_H(h->header, h->header_len);
-   PHPWRITE_H("\r\n", 2);
+   if (h->header_len > sizeof("Status:")-1 &&
+   strncasecmp(h->header, "Status:", 
sizeof("Status:")-1) == 0) {
+   if (!ignore_status) {
+   ignore_status = 1;
+   PHPWRITE_H(h->header, h->header_len);
+   PHPWRITE_H("\r\n", 2);
+   }
+   } else {
+   PHPWRITE_H(h->header, h->header_len);
+   PHPWRITE_H("\r\n", 2);
+   }
}
h = 
(sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);
}

http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/tests/010.phpt?view=markup&rev=1.1
Index: php-src/sapi/cgi/tests/010.phpt
+++ php-src/sapi/cgi/tests/010.phpt



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



[PHP-CVS] cvs: php-src(PHP_5_3) /sapi/cgi cgi_main.c /sapi/cgi/tests 010.phpt

2008-09-02 Thread Dmitry Stogov
dmitry  Tue Sep  2 13:22:16 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/sapi/cgi/tests 010.phpt 

  Modified files:  
/php-src/sapi/cgi   cgi_main.c 
  Log:
  Fixed bug #45860 (header() function fails to correctly replace all Status 
lines)
  
  
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.50.2.27&r2=1.267.2.15.2.50.2.28&diff_format=u
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50.2.27 
php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50.2.28
--- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50.2.27Tue Aug 26 15:37:01 2008
+++ php-src/sapi/cgi/cgi_main.c Tue Sep  2 13:22:15 2008
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.267.2.15.2.50.2.27 2008/08/26 15:37:01 rasmus Exp $ */
+/* $Id: cgi_main.c,v 1.267.2.15.2.50.2.28 2008/09/02 13:22:15 dmitry Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -375,6 +375,7 @@
char buf[SAPI_CGI_MAX_HEADER_LENGTH];
sapi_header_struct *h;
zend_llist_position pos;
+   zend_bool ignore_status = 0;
 
if (SG(request_info).no_headers == 1) {
return  SAPI_HEADER_SENT_SUCCESSFULLY;
@@ -430,6 +431,7 @@
}
if (!has_status) {
PHPWRITE_H(buf, len);
+   ignore_status = 1;
}
}
 
@@ -437,8 +439,17 @@
while (h) {
/* prevent CRLFCRLF */
if (h->header_len) {
-   PHPWRITE_H(h->header, h->header_len);
-   PHPWRITE_H("\r\n", 2);
+   if (h->header_len > sizeof("Status:")-1 &&
+   strncasecmp(h->header, "Status:", 
sizeof("Status:")-1) == 0) {
+   if (!ignore_status) {
+   ignore_status = 1;
+   PHPWRITE_H(h->header, h->header_len);
+   PHPWRITE_H("\r\n", 2);
+   }
+   } else {
+   PHPWRITE_H(h->header, h->header_len);
+   PHPWRITE_H("\r\n", 2);
+   }
}
h = 
(sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);
}

http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/tests/010.phpt?view=markup&rev=1.1
Index: php-src/sapi/cgi/tests/010.phpt
+++ php-src/sapi/cgi/tests/010.phpt



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



[PHP-CVS] cvs: php-src /sapi/cgi cgi_main.c /sapi/cgi/tests 010.phpt

2008-09-02 Thread Dmitry Stogov
dmitry  Tue Sep  2 13:22:27 2008 UTC

  Modified files:  
/php-src/sapi/cgi   cgi_main.c 
/php-src/sapi/cgi/tests 010.phpt 
  Log:
  Fixed bug #45860 (header() function fails to correctly replace all Status 
lines)
  
  
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.364&r2=1.365&diff_format=u
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.364 php-src/sapi/cgi/cgi_main.c:1.365
--- php-src/sapi/cgi/cgi_main.c:1.364   Tue Aug 26 15:37:38 2008
+++ php-src/sapi/cgi/cgi_main.c Tue Sep  2 13:22:27 2008
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: cgi_main.c,v 1.364 2008/08/26 15:37:38 rasmus Exp $ */
+/* $Id: cgi_main.c,v 1.365 2008/09/02 13:22:27 dmitry Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -375,6 +375,7 @@
char buf[SAPI_CGI_MAX_HEADER_LENGTH];
sapi_header_struct *h;
zend_llist_position pos;
+   zend_bool ignore_status = 0;
 
if (SG(request_info).no_headers == 1) {
return  SAPI_HEADER_SENT_SUCCESSFULLY;
@@ -431,6 +432,7 @@
 
if (!has_status) {
PHPWRITE_H(buf, len);
+   ignore_status = 1;
}
}
 
@@ -438,8 +440,17 @@
while (h) {
/* prevent CRLFCRLF */
if (h->header_len) {
-   PHPWRITE_H(h->header, h->header_len);
-   PHPWRITE_H("\r\n", 2);
+   if (h->header_len > sizeof("Status:")-1 &&
+   strncasecmp(h->header, "Status:", 
sizeof("Status:")-1) == 0) {
+   if (!ignore_status) {
+   ignore_status = 1;
+   PHPWRITE_H(h->header, h->header_len);
+   PHPWRITE_H("\r\n", 2);
+   }
+   } else {
+   PHPWRITE_H(h->header, h->header_len);
+   PHPWRITE_H("\r\n", 2);
+   }
}
h = 
(sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);
}
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/tests/010.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/sapi/cgi/tests/010.phpt
diff -u /dev/null php-src/sapi/cgi/tests/010.phpt:1.2
--- /dev/null   Tue Sep  2 13:22:27 2008
+++ php-src/sapi/cgi/tests/010.phpt Tue Sep  2 13:22:27 2008
@@ -0,0 +1,53 @@
+--TEST--
+Bug #45860 (header() function fails to correctly replace all Status lines)
+--SKIPIF--
+
+--FILE--
+');
+
+echo (`$php -n $f`);
+
+file_put_contents($f, '');
+
+echo (`$php -n $f`);
+
+file_put_contents($f, '');
+
+echo (`$php -n $f`);
+
+echo "Done\n";
+
[EMAIL PROTECTED]($f);
+?>
+--EXPECTF--
+Status: 403 Forbidden
+X-Powered-By: PHP/%s
+Content-type: text/html%s
+
+Status: 403 Forbidden
+X-Powered-By: PHP/%s
+Content-type: text/html%s
+
+X-Powered-By: PHP/%s
+Status: 403 Also Forbidden
+Content-type: text/html%s
+
+Done



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



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /sapi/cgi cgi_main.c /sapi/cgi/tests 010.phpt

2008-09-02 Thread Mikko Koppanen
On Tue, Sep 2, 2008 at 2:22 PM, Dmitry Stogov <[EMAIL PROTECTED]> wrote:
> dmitry  Tue Sep  2 13:22:16 2008 UTC
>
>  Added files: (Branch: PHP_5_3)
>/php-src/sapi/cgi/tests 010.phpt
>
>  Modified files:
>/php-src/sapi/cgi   cgi_main.c
>  Log:
>  Fixed bug #45860 (header() function fails to correctly replace all Status 
> lines)
>
>

Hello,

I was checking the same issue a bit myself and noticed one edge case
where this fix might be slightly unintuitive:

# cat test.php


# /opt/php/branches/5_3/bin/php-cgi test.php
Status: 404 Not found
X-Powered-By: PHP/5.3.0alpha3-dev
Content-type: text/html

# cat test2.php


# /opt/php/branches/5_3/bin/php-cgi test2.php
Status: 403 Forbidden
X-Powered-By: PHP/5.3.0alpha3-dev
Content-type: text/html


The question in here is: Should explicit Status: header override the
status code and message given in HTTP/ header?


-- 
Mikko Koppanen

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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcre php_pcre.c

2008-09-02 Thread Nuno Lopes
nlopess Tue Sep  2 19:10:39 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pcre   php_pcre.c 
  Log:
  kill dead variables. found by LLVM's clang static analyzer
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/php_pcre.c?r1=1.168.2.9.2.21.2.22&r2=1.168.2.9.2.21.2.23&diff_format=u
Index: php-src/ext/pcre/php_pcre.c
diff -u php-src/ext/pcre/php_pcre.c:1.168.2.9.2.21.2.22 
php-src/ext/pcre/php_pcre.c:1.168.2.9.2.21.2.23
--- php-src/ext/pcre/php_pcre.c:1.168.2.9.2.21.2.22 Fri Aug 29 12:13:54 2008
+++ php-src/ext/pcre/php_pcre.c Tue Sep  2 19:10:38 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_pcre.c,v 1.168.2.9.2.21.2.22 2008/08/29 12:13:54 helly Exp $ */
+/* $Id: php_pcre.c,v 1.168.2.9.2.21.2.23 2008/09/02 19:10:38 nlopess Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -532,7 +532,6 @@
int  matched;   /* Has 
anything matched */
int  g_notempty = 0;/* If the match 
should not be empty */
const char **stringlist;/* Holds list of 
subpatterns */
-   char*match; /* The current 
match */
char   **subpat_names;  /* Array for named 
subpatterns */
int  i, rc;
int  subpats_order; /* Order of 
subpattern matches */
@@ -611,7 +610,6 @@
}
}
 
-   match = NULL;
matched = 0;
PCRE_G(error_code) = PHP_PCRE_NO_ERROR;

@@ -632,7 +630,6 @@
/* If something has matched */
if (count > 0) {
matched++;
-   match = subject + offsets[0];
 
/* If subpatterns array has been passed, fill it in 
with values. */
if (subpats != NULL) {
@@ -1451,8 +1448,7 @@
int  start_offset;  /* Where the 
new search starts */
int  next_offset;   /* End of the 
last delimiter match + 1 */
int  g_notempty = 0;/* If the match 
should not be empty */
-   char*match, /* The current 
match */
-   *last_match;/* Location of 
last match */
+   char*last_match;/* Location of last 
match */
int  rc;
int  no_empty;  /* If 
NO_EMPTY flag is set */
int  delim_capture; /* If 
delimiters should be captured */
@@ -1489,7 +1485,6 @@
start_offset = 0;
next_offset = 0;
last_match = subject;
-   match = NULL;
PCRE_G(error_code) = PHP_PCRE_NO_ERROR;

/* Get next piece if no limit or limit not yet reached and something 
matched*/
@@ -1509,8 +1504,6 @@

/* If something matched */
if (count > 0) {
-   match = subject + offsets[0];
-
if (!no_empty || &subject[offsets[0]] != last_match) {
 
if (offset_capture) {



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



[PHP-CVS] cvs: php-src /ext/pcre php_pcre.c

2008-09-02 Thread Nuno Lopes
nlopess Tue Sep  2 19:13:24 2008 UTC

  Modified files:  
/php-src/ext/pcre   php_pcre.c 
  Log:
  MFB: kill unused var
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/php_pcre.c?r1=1.239&r2=1.240&diff_format=u
Index: php-src/ext/pcre/php_pcre.c
diff -u php-src/ext/pcre/php_pcre.c:1.239 php-src/ext/pcre/php_pcre.c:1.240
--- php-src/ext/pcre/php_pcre.c:1.239   Sun Aug 24 12:34:02 2008
+++ php-src/ext/pcre/php_pcre.c Tue Sep  2 19:13:24 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_pcre.c,v 1.239 2008/08/24 12:34:02 helly Exp $ */
+/* $Id: php_pcre.c,v 1.240 2008/09/02 19:13:24 nlopess Exp $ */
 
 /*  TODO
  *  php_pcre_replace_impl():
@@ -602,7 +602,6 @@
int  matched;   /* Has 
anything matched */
int  g_notempty = 0;/* If the match 
should not be empty */
const char **stringlist;/* Holds list of 
subpatterns */
-   char*match; /* The current 
match */
char   **subpat_names;  /* Array for named 
subpatterns */
int  i, rc;
int  subpats_order; /* Order of 
subpattern matches */
@@ -696,7 +695,6 @@
}
}
 
-   match = NULL;
matched = 0;
PCRE_G(error_code) = PHP_PCRE_NO_ERROR;

@@ -717,7 +715,6 @@
/* If something has matched */
if (count > 0) {
matched++;
-   match = subject + offsets[0];
 
/* If subpatterns array has been passed, fill it in 
with values. */
if (subpats != NULL) {
@@ -1636,8 +1633,7 @@
int  start_offset;  /* Where the 
new search starts */
int  next_offset;   /* End of the 
last delimiter match + 1 */
int  g_notempty = 0;/* If the match 
should not be empty */
-   char*match, /* The current 
match */
-   *last_match;/* Location of 
last match */
+   char*last_match;/* Location of last 
match */
int  rc;
int  no_empty;  /* If 
NO_EMPTY flag is set */
int  delim_capture; /* If 
delimiters should be captured */
@@ -1675,7 +1671,6 @@
start_offset = 0;
next_offset = 0;
last_match = subject;
-   match = NULL;
PCRE_G(error_code) = PHP_PCRE_NO_ERROR;
 
if (utype != IS_UNICODE && !(pce->compile_options & PCRE_UTF8)) {
@@ -1699,8 +1694,6 @@

/* If something matched */
if (count > 0) {
-   match = subject + offsets[0];
-
if (!no_empty || &subject[offsets[0]] != last_match) {
 
if (offset_capture) {



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



[PHP-CVS] cvs: php-src /ext/fileinfo/tests mime_content_type_002.phpt

2008-09-02 Thread Felipe Pena
felipe  Tue Sep  2 19:27:32 2008 UTC

  Added files: 
/php-src/ext/fileinfo/tests mime_content_type_002.phpt 
  Log:
  - New test
  

http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/tests/mime_content_type_002.phpt?view=markup&rev=1.1
Index: php-src/ext/fileinfo/tests/mime_content_type_002.phpt
+++ php-src/ext/fileinfo/tests/mime_content_type_002.phpt
--TEST--
mime_content_type(): Testing parameter
--FILE--

--EXPECTF--
string(%d) "%s"
string(%d) "%s"
string(9) "directory"
string(9) "directory"



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/fileinfo/tests mime_content_type_002.phpt

2008-09-02 Thread Felipe Pena
felipe  Tue Sep  2 19:28:21 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/fileinfo/tests mime_content_type_002.phpt 
  Log:
  - New test
  

http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/tests/mime_content_type_002.phpt?view=markup&rev=1.1
Index: php-src/ext/fileinfo/tests/mime_content_type_002.phpt
+++ php-src/ext/fileinfo/tests/mime_content_type_002.phpt
--TEST--
mime_content_type(): Testing parameter
--FILE--

--EXPECTF--
string(%d) "%s"
string(%d) "%s"
string(9) "directory"
string(9) "directory"



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



[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS

2008-09-02 Thread Jani Taskinen
janiTue Sep  2 08:58:01 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-srcNEWS 
  Log:
  - Fixed bug entries
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1209&r2=1.2027.2.547.2.1210&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1209 php-src/NEWS:1.2027.2.547.2.1210
--- php-src/NEWS:1.2027.2.547.2.1209Mon Sep  1 13:15:14 2008
+++ php-src/NEWSTue Sep  2 08:58:00 2008
@@ -89,6 +89,10 @@
   overlapping needles). (Moriyoshi)
 - Fixed bug #43941 (json_encode silently cuts non-UTF8 strings). (Stas)
 - Fixed bug #43782 (feof() does not detect timeout on socket). (David Soria 
Parra)
+- Fixed bug #43668 (Added odbc.default_cursortype to control the ODBC
+  cursormodel). (Patrick)
+- Fixed bug #43666 (Fixed code to use ODBC 3.52 datatypes for 64bit systems). 
+  (Patrick)
 - Fixed bug #42737 (preg_split('//u') triggers a E_NOTICE with newlines).
   (Nuno)
 - Fixed bug #42604 ("make test" fails with --with-config-file-scan-dir=path).



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



[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS

2008-09-02 Thread Jani Taskinen
janiTue Sep  2 08:58:18 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-srcNEWS 
  Log:
  - Moved to PHP_5_2
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.305&r2=1.2027.2.547.2.965.2.306&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.305 
php-src/NEWS:1.2027.2.547.2.965.2.306
--- php-src/NEWS:1.2027.2.547.2.965.2.305   Mon Sep  1 20:51:57 2008
+++ php-src/NEWSTue Sep  2 08:58:18 2008
@@ -44,10 +44,6 @@
 - Fixed bug #45706 (Unserialization of classes derived from ArrayIterator
   fails). (Etienne, Dmitry)
 - Fixed bug #45696 (Not all DateTime methods allow method chaining). (Derick)
-- Fixed bug #43668 (Added odbc.default_cursortype to control the ODBC
-  cursormodel). (Patrick)
-- Fixed bug #43666 (Fixed code to use ODBC 3.52 datatypes for 64bit systems). 
-  (Patrick)
 - Fixed bug #45636 (fileinfo ext duplicate strndup). (Derick)
 - Fixed bug #45545 (DateInterval has 4 char limitation for ISO durations).
   (Derick)



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