[PHP-CVS-DAILY] cvs: php-src / ChangeLog

2006-06-21 Thread changelog
changelog   Thu Jun 22 02:29:20 2006 UTC

  Modified files:  
/php-srcChangeLog 
  Log:
  ChangeLog update
  http://cvs.php.net/viewvc.cgi/php-src/ChangeLog?r1=1.2369r2=1.2370diff_format=u
Index: php-src/ChangeLog
diff -u php-src/ChangeLog:1.2369 php-src/ChangeLog:1.2370
--- php-src/ChangeLog:1.2369Wed Jun  7 05:31:59 2006
+++ php-src/ChangeLog   Thu Jun 22 02:29:20 2006
@@ -1,3 +1,881 @@
+2006-06-21  Andrei Zmievski  [EMAIL PROTECTED]
+
+* ZendEngine2/zend_constants.c
+  ZendEngine2/zend_unicode.c
+  ZendEngine2/zend_unicode.h
+  main/streams/filter.c
+  main/streams/streams.c:
+  Implement user conversion error handler support. Works as normal error
+  handler, in that it can return false to make the default one take over.
+  Handler signature is:
+user_handler($direction, $encoding, $char_byte, $offset, $message)
+  
+  Also removed support for using exceptions in default error handler.
+
+* main/streams/streams.c:
+  Typos.
+
+2006-06-21  Ilia Alshanetsky  [EMAIL PROTECTED]
+
+* ext/bz2/bz2_filter.c:
+  MFB: Fixed compiler warnings.
+
+* (PHP_5_2)
+  ext/bz2/bz2_filter.c:
+  Fixed compiler warnings.
+
+2006-06-21  Antony Dovgal  [EMAIL PROTECTED]
+
+* (PHP_5_2)
+  ext/bz2/bz2.c
+  ext/bz2/tests/001.phpt
+  ext/bz2/tests/002.phpt:
+  MFH: improve check for stream mode, add tests
+
+* ext/bz2/bz2.c
+  ext/bz2/tests/001.phpt
+  ext/bz2/tests/001.phpt
+  ext/bz2/tests/002.phpt
+  ext/bz2/tests/002.phpt:
+  improve check for stream mode, add tests
+
+* (PHP_5_2)
+  ext/bz2/bz2.c:
+  MFH: don't try to read or write from/to a stream if it was open in
+  different mode (leads to segfault in libbz2)
+
+* ext/bz2/bz2.c:
+  don't try to read or write from/to a stream if it was open in different
+  mode (leads to segfault in libbz2)
+
+* (PHP_5_2)
+  ext/bz2/bz2.c:
+  MFH: fix invalid read with bzopen(,) and prevent filename from being
+  empty (which causes endless loop somewhere is libbz2)
+
+* ext/bz2/bz2.c:
+  fix invalid read with bzopen(,) and prevent filename from being empty
+  (which causes endless loop somewhere is libbz2)
+  tests will follow
+
+* ext/oci8/oci8.c:
+  fix compile failure with sancient/s older PHP versions caused by new
+  globals management code
+
+2006-06-20  Andrei Zmievski  [EMAIL PROTECTED]
+
+* ZendEngine2/zend.c
+  ZendEngine2/zend_execute_API.c
+  ZendEngine2/zend_globals.h:
+  Implement unicode_set_error_handler() / unicode_restore_error_handler().
+  The error handler doesn't do anything yet. (vaporware)
+
+* ZendEngine2/zend_builtin_functions.c:
+  Plug memory leak in set_exception_handler().
+
+2006-06-20  Ilia Alshanetsky  [EMAIL PROTECTED]
+
+* ext/tokenizer/php_tokenizer.h
+  ext/tokenizer/tokenizer.c:
+  MFB: Removed pointless callbacks.
+
+* (PHP_5_2)
+  ext/tokenizer/php_tokenizer.h
+  ext/tokenizer/tokenizer.c:
+  Removed pointless callbacks.
+
+2006-06-20  Nuno Lopes  [EMAIL PROTECTED]
+
+* ext/standard/tests/file/bug37864.phpt:
+  MFB 5.2
+
+* (PHP_5_2)
+  ext/standard/tests/file/bug37864.phpt:
+  make sure the test outputs what we want
+
+2006-06-20  Hannes Magnusson  [EMAIL PROTECTED]
+
+* (PHP_5_2)
+  NEWS:
+  Bug fix news...
+
+* (PHP_5_2)
+  ext/standard/tests/file/file_get_contents.phpt:
+  Renamed to bug37864.phpt
+
+* ext/standard/tests/file/file_get_contents.phpt:
+  Renamed file to bug37864.phpt
+
+* ext/standard/tests/file/bug37864.phpt
+  ext/standard/tests/file/bug37864.phpt:
+  
+  Test for bug #37864 (file_get_contents() leaks on empty file)
+
+2006-06-20  Antony Dovgal  [EMAIL PROTECTED]
+
+* ext/standard/tests/file/file_get_contents.phpt
+  ext/standard/tests/file/file_get_contents.phpt:
+  don't leave garbage in tmp dir
+
+2006-06-20  Hannes Magnusson  [EMAIL PROTECTED]
+
+* (PHP_5_2)
+  ext/standard/tests/file/file_get_contents.phpt:
+  MFH: test for file_get_contents leaking on empty file
+
+* ext/standard/tests/file/file_get_contents.phpt
+  ext/standard/tests/file/file_get_contents.phpt:
+  
+  add test for file_get_contents() leaking on empty file
+
+* main/streams/streams.c:
+  Plug memleak (leaks on empty files)
+
+* ext/dom/php_dom.h:
+  Add missing header include
+
+2006-06-20  Antony Dovgal  [EMAIL PROTECTED]
+
+* ZendEngine2/zend_API.c:
+  init variables
+
+* (PHP_5_2)
+  ext/dom/document.c:
+  MFH: nuke unused variables and init variables when needed
+
+* ext/dom/document.c:
+  nuke unused variables and init variables when needed
+
+* ext/standard/tests/general_functions/sunfuncts.phpt:
+  fix test to work on all platforms
+
+* (PHP_5_2)
+  ZendEngine2/tests/objects_013.phpt
+  

[PHP-CVS-DAILY] cvs: ZendEngine2 / ChangeLog

2006-06-21 Thread changelog
changelog   Thu Jun 22 02:29:26 2006 UTC

  Modified files:  
/ZendEngine2ChangeLog 
  Log:
  ChangeLog update
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/ChangeLog?r1=1.933r2=1.934diff_format=u
Index: ZendEngine2/ChangeLog
diff -u ZendEngine2/ChangeLog:1.933 ZendEngine2/ChangeLog:1.934
--- ZendEngine2/ChangeLog:1.933 Wed Jun  7 05:32:04 2006
+++ ZendEngine2/ChangeLog   Thu Jun 22 02:29:26 2006
@@ -1,3 +1,154 @@
+2006-06-21  Andrei Zmievski  [EMAIL PROTECTED]
+
+* zend_constants.c
+  zend_unicode.c
+  zend_unicode.h:
+  Implement user conversion error handler support. Works as normal error
+  handler, in that it can return false to make the default one take over.
+  Handler signature is:
+user_handler($direction, $encoding, $char_byte, $offset, $message)
+  
+  Also removed support for using exceptions in default error handler.
+
+2006-06-20  Andrei Zmievski  [EMAIL PROTECTED]
+
+* zend.c
+  zend_execute_API.c
+  zend_globals.h:
+  Implement unicode_set_error_handler() / unicode_restore_error_handler().
+  The error handler doesn't do anything yet. (vaporware)
+
+* zend_builtin_functions.c:
+  Plug memory leak in set_exception_handler().
+
+2006-06-20  Antony Dovgal  [EMAIL PROTECTED]
+
+* zend_API.c:
+  init variables
+
+* (PHP_5_2)
+  tests/objects_013.phpt:
+  fix test
+
+* tests/objects_013.phpt
+  tests/objects_014.phpt:
+  fix tests
+
+2006-06-19  Antony Dovgal  [EMAIL PROTECTED]
+
+* (PHP_5_2)
+  tests/bug33732.phpt
+  tests/objects_014.phpt:
+  fix tests
+
+2006-06-15  Dmitry Stogov  [EMAIL PROTECTED]
+
+* (PHP_5_2)
+  zend_API.c
+  zend_API.h
+  zend_modules.h:
+  MFH: Added automatic module globals management.
+
+2006-06-13  Marcus Boerger  [EMAIL PROTECTED]
+
+* zend_exceptions.c:
+  - Arginfo fix (Hannes)
+
+2006-06-13  Dmitry Stogov  [EMAIL PROTECTED]
+
+* zend_API.c
+  zend_API.h
+  zend_modules.h:
+  Added automatic module globals management.
+
+2006-06-13  Stefan Esser  [EMAIL PROTECTED]
+
+* zend.c
+  zend_compile.c
+  zend_compile.h
+  zend_execute_API.c
+  zend_vm_def.h
+  zend_vm_execute.h:
+  Added hook for compile_string()
+
+2006-06-12  Marcus Boerger  [EMAIL PROTECTED]
+
+* zend.c:
+  - Fix memleaks (by nuno)
+
+2006-06-12  Andrei Zmievski  [EMAIL PROTECTED]
+
+* zend.h
+  zend_language_scanner.l:
+  Be more explicit.
+
+2006-06-11  Ilia Alshanetsky  [EMAIL PROTECTED]
+
+* (PHP_5_2)
+  zend.c
+  zend.h:
+  Make zend_print_zval_r_ex() use the write callback function.
+
+2006-06-08  Dmitry Stogov  [EMAIL PROTECTED]
+
+* zend_vm_def.h
+  zend_vm_def.h
+  zend_vm_execute.h
+  zend_vm_execute.h
+  tests/bug37707.phpt
+  tests/bug37707.phpt:
+  Proper fix for bug #37707 (clone $x must call __clone() enven if result
+  value is not used)
+
+* zend_vm_def.h
+  zend_vm_def.h
+  zend_vm_execute.h
+  zend_vm_execute.h
+  zend_vm_gen.php
+  zend_vm_gen.php:
+  Wrap wrong unreachable code with #if 0
+
+2006-06-07  Ilia Alshanetsky  [EMAIL PROTECTED]
+
+* zend_vm_def.h
+  zend_vm_execute.h
+  tests/bug37707.phpt:
+  MFB: Fixed bug #37707 clone without assigning leaks memory
+
+* tests/bug37707.phpt
+  tests/bug37707.phpt:
+  
+  file bug37707.phpt was initially added on branch PHP_5_2.
+
+* (PHP_5_2)
+  zend_vm_def.h
+  zend_vm_execute.h:
+  Fixed bug #37707 clone without assigning leaks memory
+  
+
+2006-06-07  Marcus Boerger  [EMAIL PROTECTED]
+
+* (PHP_5_2)
+  zend_API.c
+  zend_API.h:
+  - MFH zend_fcall_info_*() and parameter parsing option 'f'
+
+* zend_vm_execute.h
+  zend_vm_execute.h:
+  - Regenerated after zend_vm_def.h change
+
+* (PHP_5_2)
+  zend_API.c
+  zend_compile.c
+  zend_vm_def.h:
+  - MFH Fix issue with interfaces being inherited multiple times
+
+* zend_API.c
+  zend_compile.c
+  zend_compile.c
+  zend_vm_def.h:
+  - Fix issue with interfaces being inherited multiple times
+
 2006-06-06  Antony Dovgal  [EMAIL PROTECTED]
 
 * zend_compile.c
@@ -14016,7 +14167,7 @@
 2003-06-10  Jani Taskinen  [EMAIL PROTECTED]
 
 * zend_multiply.h:
-  - Missing $Id: ChangeLog,v 1.933 2006/06/07 05:32:04 changelog Exp $ tag
+  - Missing $Id: ChangeLog,v 1.934 2006/06/22 02:29:26 changelog Exp $ tag
 
 2003-06-10  James Cox  [EMAIL PROTECTED]
 
@@ -15740,7 +15891,7 @@
   zend_types.h
   zend_variables.c
   zend_variables.h:
-  - Added some missing CVS $Id: ChangeLog,v 1.933 2006/06/07 05:32:04 
changelog Exp $ tags, headers and footers.
+  - Added some missing CVS $Id: ChangeLog,v 1.934 2006/06/22 02:29:26 
changelog Exp $ tags, headers and footers.
 
 2003-01-30  Ilia Alshanetsky  [EMAIL PROTECTED]
 


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

2006-06-21 Thread Antony Dovgal
tony2001Wed Jun 21 12:42:50 2006 UTC

  Modified files:  
/php-src/ext/bz2bz2.c 
  Log:
  fix invalid read with bzopen(,) and prevent filename from being empty 
(which causes endless loop somewhere is libbz2)
  tests will follow
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2.c?r1=1.20r2=1.21diff_format=u
Index: php-src/ext/bz2/bz2.c
diff -u php-src/ext/bz2/bz2.c:1.20 php-src/ext/bz2/bz2.c:1.21
--- php-src/ext/bz2/bz2.c:1.20  Sat Jun 10 22:59:39 2006
+++ php-src/ext/bz2/bz2.c   Wed Jun 21 12:42:50 2006
@@ -16,7 +16,7 @@
   +--+
 */
  
-/* $Id: bz2.c,v 1.20 2006/06/10 22:59:39 bjori Exp $ */
+/* $Id: bz2.c,v 1.21 2006/06/21 12:42:50 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -353,7 +353,7 @@
}
convert_to_string_ex(mode);
 
-   if (Z_STRVAL_PP(mode)[0] != 'r'  Z_STRVAL_PP(mode)[0] != 'w'  
Z_STRVAL_PP(mode)[1] != '\0') {
+   if (Z_STRLEN_PP(mode) != 1 || (Z_STRVAL_PP(mode)[0] != 'r'  
Z_STRVAL_PP(mode)[0] != 'w')) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, '%s' is not a 
valid mode for bzopen(). Only 'w' and 'r' are supported., Z_STRVAL_PP(mode));
RETURN_FALSE;
}
@@ -361,6 +361,12 @@
/* If it's not a resource its a string containing the filename to open 
*/
if (Z_TYPE_PP(file) != IS_RESOURCE) {
convert_to_string_ex(file);
+
+   if (Z_STRLEN_PP(file) == 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, filename 
cannot be empty);
+   RETURN_FALSE;
+   }
+
stream = php_stream_bz2open(NULL,

Z_STRVAL_PP(file), 

Z_STRVAL_PP(mode), 

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/bz2 bz2.c

2006-06-21 Thread Antony Dovgal
tony2001Wed Jun 21 12:43:27 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/bz2bz2.c 
  Log:
  MFH: fix invalid read with bzopen(,) and prevent filename from being 
empty (which causes endless loop somewhere is libbz2)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2.c?r1=1.14.2.3.2.1r2=1.14.2.3.2.2diff_format=u
Index: php-src/ext/bz2/bz2.c
diff -u php-src/ext/bz2/bz2.c:1.14.2.3.2.1 php-src/ext/bz2/bz2.c:1.14.2.3.2.2
--- php-src/ext/bz2/bz2.c:1.14.2.3.2.1  Sun Jun 11 01:42:16 2006
+++ php-src/ext/bz2/bz2.c   Wed Jun 21 12:43:27 2006
@@ -16,7 +16,7 @@
   +--+
 */
  
-/* $Id: bz2.c,v 1.14.2.3.2.1 2006/06/11 01:42:16 bjori Exp $ */
+/* $Id: bz2.c,v 1.14.2.3.2.2 2006/06/21 12:43:27 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -359,7 +359,7 @@
}
convert_to_string_ex(mode);
 
-   if (Z_STRVAL_PP(mode)[0] != 'r'  Z_STRVAL_PP(mode)[0] != 'w'  
Z_STRVAL_PP(mode)[1] != '\0') {
+   if (Z_STRLEN_PP(mode) != 1 || (Z_STRVAL_PP(mode)[0] != 'r'  
Z_STRVAL_PP(mode)[0] != 'w')) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, '%s' is not a 
valid mode for bzopen(). Only 'w' and 'r' are supported., Z_STRVAL_PP(mode));
RETURN_FALSE;
}
@@ -367,6 +367,12 @@
/* If it's not a resource its a string containing the filename to open 
*/
if (Z_TYPE_PP(file) != IS_RESOURCE) {
convert_to_string_ex(file);
+
+   if (Z_STRLEN_PP(file) == 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, filename 
cannot be empty);
+   RETURN_FALSE;
+   }
+
stream = php_stream_bz2open(NULL,

Z_STRVAL_PP(file), 

Z_STRVAL_PP(mode), 

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



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

2006-06-21 Thread Antony Dovgal
tony2001Wed Jun 21 13:12:00 2006 UTC

  Modified files:  
/php-src/ext/bz2bz2.c 
  Log:
  don't try to read or write from/to a stream if it was open in different mode 
(leads to segfault in libbz2)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2.c?r1=1.21r2=1.22diff_format=u
Index: php-src/ext/bz2/bz2.c
diff -u php-src/ext/bz2/bz2.c:1.21 php-src/ext/bz2/bz2.c:1.22
--- php-src/ext/bz2/bz2.c:1.21  Wed Jun 21 12:42:50 2006
+++ php-src/ext/bz2/bz2.c   Wed Jun 21 13:12:00 2006
@@ -16,7 +16,7 @@
   +--+
 */
  
-/* $Id: bz2.c,v 1.21 2006/06/21 12:42:50 tony2001 Exp $ */
+/* $Id: bz2.c,v 1.22 2006/06/21 13:12:00 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -378,6 +378,18 @@
 
php_stream_from_zval(stream, file);
 
+   if (!memchr(stream-mode, Z_STRVAL_PP(mode)[0], 
strlen(stream-mode))) {
+   switch (Z_STRVAL_PP(mode)[0]) {
+   case 'r':
+   php_error_docref(NULL TSRMLS_CC, 
E_WARNING, cannot read from a stream opened in write only mode);
+   break;
+   case 'w':
+   php_error_docref(NULL TSRMLS_CC, 
E_WARNING, cannot write to a stream opened in read only mode);
+   break;
+   }
+   RETURN_FALSE;
+   }
+
if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_FD, (void 
*) fd, REPORT_ERRORS)) {
RETURN_FALSE;
}

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/bz2 bz2.c

2006-06-21 Thread Antony Dovgal
tony2001Wed Jun 21 13:12:37 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/bz2bz2.c 
  Log:
  MFH: don't try to read or write from/to a stream if it was open in different 
mode (leads to segfault in libbz2)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2.c?r1=1.14.2.3.2.2r2=1.14.2.3.2.3diff_format=u
Index: php-src/ext/bz2/bz2.c
diff -u php-src/ext/bz2/bz2.c:1.14.2.3.2.2 php-src/ext/bz2/bz2.c:1.14.2.3.2.3
--- php-src/ext/bz2/bz2.c:1.14.2.3.2.2  Wed Jun 21 12:43:27 2006
+++ php-src/ext/bz2/bz2.c   Wed Jun 21 13:12:37 2006
@@ -16,7 +16,7 @@
   +--+
 */
  
-/* $Id: bz2.c,v 1.14.2.3.2.2 2006/06/21 12:43:27 tony2001 Exp $ */
+/* $Id: bz2.c,v 1.14.2.3.2.3 2006/06/21 13:12:37 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -384,6 +384,18 @@
 
php_stream_from_zval(stream, file);
 
+   if (!memchr(stream-mode, Z_STRVAL_PP(mode)[0], 
strlen(stream-mode))) {
+   switch (Z_STRVAL_PP(mode)[0]) {
+   case 'r':
+   php_error_docref(NULL TSRMLS_CC, 
E_WARNING, cannot read from a stream opened in write only mode);
+   break;
+   case 'w':
+   php_error_docref(NULL TSRMLS_CC, 
E_WARNING, cannot write to a stream opened in read only mode);
+   break;
+   }
+   RETURN_FALSE;
+   }
+
if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_FD, (void 
*) fd, REPORT_ERRORS)) {
RETURN_FALSE;
}

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



[PHP-CVS] cvs: php-src /ext/bz2 bz2.c /ext/bz2/tests 001.phpt 002.phpt

2006-06-21 Thread Antony Dovgal
tony2001Wed Jun 21 14:38:06 2006 UTC

  Added files: 
/php-src/ext/bz2/tests  001.phpt 002.phpt 

  Modified files:  
/php-src/ext/bz2bz2.c 
  Log:
  improve check for stream mode, add tests
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2.c?r1=1.22r2=1.23diff_format=u
Index: php-src/ext/bz2/bz2.c
diff -u php-src/ext/bz2/bz2.c:1.22 php-src/ext/bz2/bz2.c:1.23
--- php-src/ext/bz2/bz2.c:1.22  Wed Jun 21 13:12:00 2006
+++ php-src/ext/bz2/bz2.c   Wed Jun 21 14:38:06 2006
@@ -16,7 +16,7 @@
   +--+
 */
  
-/* $Id: bz2.c,v 1.22 2006/06/21 13:12:00 tony2001 Exp $ */
+/* $Id: bz2.c,v 1.23 2006/06/21 14:38:06 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -375,19 +375,39 @@
} else {
/* If it is a resource, than its a stream resource */
int fd;
+   int stream_mode_len;
 
php_stream_from_zval(stream, file);
+   stream_mode_len = strlen(stream-mode);
+   
+   if (stream_mode_len != 1  !(stream_mode_len == 2  
memchr(stream-mode, 'b', 2))) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, cannot use 
stream opened in mode '%s', stream-mode);
+   RETURN_FALSE;
+   } else if (stream_mode_len == 1  stream-mode[0] != 'r'  
stream-mode[0] != 'w'  stream-mode[0] != 'a'  stream-mode[0] != 'x') {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, cannot use 
stream opened in mode '%s', stream-mode);
+   RETURN_FALSE;
+   }
 
-   if (!memchr(stream-mode, Z_STRVAL_PP(mode)[0], 
strlen(stream-mode))) {
-   switch (Z_STRVAL_PP(mode)[0]) {
-   case 'r':
+   switch(Z_STRVAL_PP(mode)[0]) {
+   case 'r':
+   /* only r and rb are supported */
+   if (stream-mode[0] != Z_STRVAL_PP(mode)[0]  
!(stream_mode_len == 2  stream-mode[1] != Z_STRVAL_PP(mode)[0])) {
php_error_docref(NULL TSRMLS_CC, 
E_WARNING, cannot read from a stream opened in write only mode);
-   break;
-   case 'w':
+   RETURN_FALSE;
+   }
+   break;
+   case 'w':
+   /* support only w(b), a(b), x(b) */
+   if (stream-mode[0] != Z_STRVAL_PP(mode)[0]  
!(stream_mode_len == 2  stream-mode[1] != Z_STRVAL_PP(mode)[0])
+stream-mode[0] != 'a'  
!(stream_mode_len == 2  stream-mode[1] != 'a')
+stream-mode[0] != 'x'  
!(stream_mode_len == 2  stream-mode[1] != 'x')) {
php_error_docref(NULL TSRMLS_CC, 
E_WARNING, cannot write to a stream opened in read only mode);
-   break;
-   }
-   RETURN_FALSE;
+   RETURN_FALSE;
+   }
+   break;
+   default:
+   /* not reachable */
+   break;
}
 
if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_FD, (void 
*) fd, REPORT_ERRORS)) {

http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/tests/001.phpt?view=markuprev=1.1
Index: php-src/ext/bz2/tests/001.phpt
+++ php-src/ext/bz2/tests/001.phpt
--TEST--
bzopen() and invalid parameters
--FILE--
?php

var_dump(bzopen());
var_dump(bzopen(, ));
var_dump(bzopen(, r));
var_dump(bzopen(, w));
var_dump(bzopen(, x));
var_dump(bzopen(, rw));
var_dump(bzopen(no_such_file, r));

$fp = fopen(__FILE__,r);
var_dump(bzopen($fp, r));

echo Done\n;
?
--EXPECTF-- 
Warning: Wrong parameter count for bzopen() in %s on line %d
NULL

Warning: bzopen(): '' is not a valid mode for bzopen(). Only 'w' and 'r' are 
supported. in %s on line %d
bool(false)

Warning: bzopen(): filename cannot be empty in %s on line %d
bool(false)

Warning: bzopen(): filename cannot be empty in %s on line %d
bool(false)

Warning: bzopen(): 'x' is not a valid mode for bzopen(). Only 'w' and 'r' are 
supported. in %s on line %d
bool(false)

Warning: bzopen(): 'rw' is not a valid mode for bzopen(). Only 'w' and 'r' are 
supported. in %s on line %d
bool(false)

Warning: bzopen(no_such_file): failed to open stream: No such file or directory 
in %s on line %d
bool(false)
resource(%d) of type (stream)
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/tests/002.phpt?view=markuprev=1.1
Index: php-src/ext/bz2/tests/002.phpt
+++ php-src/ext/bz2/tests/002.phpt
--TEST--
bzopen() using fd opened in wrong mode

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/bz2 bz2.c /ext/bz2/tests 001.phpt 002.phpt

2006-06-21 Thread Antony Dovgal
tony2001Wed Jun 21 14:38:28 2006 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/bz2/tests  001.phpt 002.phpt 

  Modified files:  
/php-src/ext/bz2bz2.c 
  Log:
  MFH: improve check for stream mode, add tests
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2.c?r1=1.14.2.3.2.3r2=1.14.2.3.2.4diff_format=u
Index: php-src/ext/bz2/bz2.c
diff -u php-src/ext/bz2/bz2.c:1.14.2.3.2.3 php-src/ext/bz2/bz2.c:1.14.2.3.2.4
--- php-src/ext/bz2/bz2.c:1.14.2.3.2.3  Wed Jun 21 13:12:37 2006
+++ php-src/ext/bz2/bz2.c   Wed Jun 21 14:38:28 2006
@@ -16,7 +16,7 @@
   +--+
 */
  
-/* $Id: bz2.c,v 1.14.2.3.2.3 2006/06/21 13:12:37 tony2001 Exp $ */
+/* $Id: bz2.c,v 1.14.2.3.2.4 2006/06/21 14:38:28 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -381,19 +381,39 @@
} else {
/* If it is a resource, than its a stream resource */
int fd;
+   int stream_mode_len;
 
php_stream_from_zval(stream, file);
+   stream_mode_len = strlen(stream-mode);
+   
+   if (stream_mode_len != 1  !(stream_mode_len == 2  
memchr(stream-mode, 'b', 2))) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, cannot use 
stream opened in mode '%s', stream-mode);
+   RETURN_FALSE;
+   } else if (stream_mode_len == 1  stream-mode[0] != 'r'  
stream-mode[0] != 'w'  stream-mode[0] != 'a'  stream-mode[0] != 'x') {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, cannot use 
stream opened in mode '%s', stream-mode);
+   RETURN_FALSE;
+   }
 
-   if (!memchr(stream-mode, Z_STRVAL_PP(mode)[0], 
strlen(stream-mode))) {
-   switch (Z_STRVAL_PP(mode)[0]) {
-   case 'r':
+   switch(Z_STRVAL_PP(mode)[0]) {
+   case 'r':
+   /* only r and rb are supported */
+   if (stream-mode[0] != Z_STRVAL_PP(mode)[0]  
!(stream_mode_len == 2  stream-mode[1] != Z_STRVAL_PP(mode)[0])) {
php_error_docref(NULL TSRMLS_CC, 
E_WARNING, cannot read from a stream opened in write only mode);
-   break;
-   case 'w':
+   RETURN_FALSE;
+   }
+   break;
+   case 'w':
+   /* support only w(b), a(b), x(b) */
+   if (stream-mode[0] != Z_STRVAL_PP(mode)[0]  
!(stream_mode_len == 2  stream-mode[1] != Z_STRVAL_PP(mode)[0])
+stream-mode[0] != 'a'  
!(stream_mode_len == 2  stream-mode[1] != 'a')
+stream-mode[0] != 'x'  
!(stream_mode_len == 2  stream-mode[1] != 'x')) {
php_error_docref(NULL TSRMLS_CC, 
E_WARNING, cannot write to a stream opened in read only mode);
-   break;
-   }
-   RETURN_FALSE;
+   RETURN_FALSE;
+   }
+   break;
+   default:
+   /* not reachable */
+   break;
}
 
if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_FD, (void 
*) fd, REPORT_ERRORS)) {

http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/tests/001.phpt?view=markuprev=1.1
Index: php-src/ext/bz2/tests/001.phpt
+++ php-src/ext/bz2/tests/001.phpt
--TEST--
bzopen() and invalid parameters
--FILE--
?php

var_dump(bzopen());
var_dump(bzopen(, ));
var_dump(bzopen(, r));
var_dump(bzopen(, w));
var_dump(bzopen(, x));
var_dump(bzopen(, rw));
var_dump(bzopen(no_such_file, r));

$fp = fopen(__FILE__,r);
var_dump(bzopen($fp, r));

echo Done\n;
?
--EXPECTF-- 
Warning: Wrong parameter count for bzopen() in %s on line %d
NULL

Warning: bzopen(): '' is not a valid mode for bzopen(). Only 'w' and 'r' are 
supported. in %s on line %d
bool(false)

Warning: bzopen(): filename cannot be empty in %s on line %d
bool(false)

Warning: bzopen(): filename cannot be empty in %s on line %d
bool(false)

Warning: bzopen(): 'x' is not a valid mode for bzopen(). Only 'w' and 'r' are 
supported. in %s on line %d
bool(false)

Warning: bzopen(): 'rw' is not a valid mode for bzopen(). Only 'w' and 'r' are 
supported. in %s on line %d
bool(false)

Warning: bzopen(no_such_file): failed to open stream: No such file or directory 
in %s on line %d
bool(false)
resource(%d) of type (stream)
Done

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

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/bz2 bz2_filter.c

2006-06-21 Thread Ilia Alshanetsky
iliaa   Wed Jun 21 15:19:24 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/bz2bz2_filter.c 
  Log:
  Fixed compiler warnings.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2_filter.c?r1=1.3.2.2r2=1.3.2.2.2.1diff_format=u
Index: php-src/ext/bz2/bz2_filter.c
diff -u php-src/ext/bz2/bz2_filter.c:1.3.2.2 
php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.1
--- php-src/ext/bz2/bz2_filter.c:1.3.2.2Sun Jan  1 12:50:00 2006
+++ php-src/ext/bz2/bz2_filter.cWed Jun 21 15:19:23 2006
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bz2_filter.c,v 1.3.2.2 2006/01/01 12:50:00 sniper Exp $ */
+/* $Id: bz2_filter.c,v 1.3.2.2.2.1 2006/06/21 15:19:23 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -274,7 +274,7 @@
/* Create this filter */
data = pecalloc(1, sizeof(php_bz2_filter_data), persistent);
if (!data) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed allocating 
%d bytes., sizeof(php_bz2_filter_data));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed allocating 
%ld bytes., sizeof(php_bz2_filter_data));
return NULL;
}
 
@@ -287,14 +287,14 @@
data-strm.avail_out = data-outbuf_len = data-inbuf_len = 2048;
data-strm.next_in = data-inbuf = (char *) pemalloc(data-inbuf_len, 
persistent);
if (!data-inbuf) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed allocating 
%d bytes., data-inbuf_len);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed allocating 
%ld bytes., data-inbuf_len);
pefree(data, persistent);
return NULL;
}
data-strm.avail_in = 0;
data-strm.next_out = data-outbuf = (char *) 
pemalloc(data-outbuf_len, persistent);
if (!data-outbuf) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed allocating 
%d bytes., data-outbuf_len);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed allocating 
%ld bytes., data-outbuf_len);
pefree(data-inbuf, persistent);
pefree(data, persistent);
return NULL;

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



[PHP-CVS] cvs: php-src /ext/bz2 bz2_filter.c

2006-06-21 Thread Ilia Alshanetsky
iliaa   Wed Jun 21 15:19:37 2006 UTC

  Modified files:  
/php-src/ext/bz2bz2_filter.c 
  Log:
  MFB: Fixed compiler warnings.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2_filter.c?r1=1.7r2=1.8diff_format=u
Index: php-src/ext/bz2/bz2_filter.c
diff -u php-src/ext/bz2/bz2_filter.c:1.7 php-src/ext/bz2/bz2_filter.c:1.8
--- php-src/ext/bz2/bz2_filter.c:1.7Mon Mar 13 04:40:11 2006
+++ php-src/ext/bz2/bz2_filter.cWed Jun 21 15:19:37 2006
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bz2_filter.c,v 1.7 2006/03/13 04:40:11 pollita Exp $ */
+/* $Id: bz2_filter.c,v 1.8 2006/06/21 15:19:37 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -290,7 +290,7 @@
/* Create this filter */
data = pecalloc(1, sizeof(php_bz2_filter_data), persistent);
if (!data) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed allocating 
%d bytes., sizeof(php_bz2_filter_data));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed allocating 
%ld bytes., sizeof(php_bz2_filter_data));
return NULL;
}
 
@@ -303,14 +303,14 @@
data-strm.avail_out = data-outbuf_len = data-inbuf_len = 2048;
data-strm.next_in = data-inbuf = (char *) pemalloc(data-inbuf_len, 
persistent);
if (!data-inbuf) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed allocating 
%d bytes., data-inbuf_len);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed allocating 
%ld bytes., data-inbuf_len);
pefree(data, persistent);
return NULL;
}
data-strm.avail_in = 0;
data-strm.next_out = data-outbuf = (char *) 
pemalloc(data-outbuf_len, persistent);
if (!data-outbuf) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed allocating 
%d bytes., data-outbuf_len);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed allocating 
%ld bytes., data-outbuf_len);
pefree(data-inbuf, persistent);
pefree(data, persistent);
return NULL;

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



[PHP-CVS] Re: cvs: php-src(PHP_5_2) /ext/bz2 bz2_filter.c

2006-06-21 Thread Michael Wallner

Ilia Alshanetsky wrote:

iliaa   Wed Jun 21 15:19:24 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/bz2	bz2_filter.c 
  Log:

  Fixed compiler warnings.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2_filter.c?r1=1.3.2.2r2=1.3.2.2.2.1diff_format=u

Index: php-src/ext/bz2/bz2_filter.c
diff -u php-src/ext/bz2/bz2_filter.c:1.3.2.2 
php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.1
--- php-src/ext/bz2/bz2_filter.c:1.3.2.2Sun Jan  1 12:50:00 2006
+++ php-src/ext/bz2/bz2_filter.cWed Jun 21 15:19:23 2006
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bz2_filter.c,v 1.3.2.2 2006/01/01 12:50:00 sniper Exp $ */

+/* $Id: bz2_filter.c,v 1.3.2.2.2.1 2006/06/21 15:19:23 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H

 #include config.h
@@ -274,7 +274,7 @@
/* Create this filter */
data = pecalloc(1, sizeof(php_bz2_filter_data), persistent);
if (!data) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed allocating %d 
bytes., sizeof(php_bz2_filter_data));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed allocating %ld 
bytes., sizeof(php_bz2_filter_data));
return NULL;
}



Hi, I don't know what you're running but here size_t is unsigned int.
It's probably unsigned long on 64bit boxen, so what's this fix about?

Regards,
--
Michael

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



Re: [PHP-CVS] Re: cvs: php-src(PHP_5_2) /ext/bz2 bz2_filter.c

2006-06-21 Thread Stefan Esser

 Hi, I don't know what you're running but here size_t is unsigned int.
 It's probably unsigned long on 64bit boxen, so what's this fix about?
The question is: what are you running? size_t usually is unsigned long.

Stefan

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



Re: [PHP-CVS] Re: cvs: php-src(PHP_5_2) /ext/bz2 bz2_filter.c

2006-06-21 Thread Ilia Alshanetsky
On my 2 32 bit machines the compiler complains about int being used  
where a non-int or a long value is returned. Changing it to long  
fixes the problem, this is replicated on gcc 3.4 and 4.0.1



On 21-Jun-06, at 12:08 PM, Michael Wallner wrote:


Ilia Alshanetsky wrote:

iliaa   Wed Jun 21 15:19:24 2006 UTC
  Modified files:  (Branch: PHP_5_2)
/php-src/ext/bz2bz2_filter.c   Log:
  Fixed compiler warnings.
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2_filter.c? 
r1=1.3.2.2r2=1.3.2.2.2.1diff_format=u

Index: php-src/ext/bz2/bz2_filter.c
diff -u php-src/ext/bz2/bz2_filter.c:1.3.2.2 php-src/ext/bz2/ 
bz2_filter.c:1.3.2.2.2.1

--- php-src/ext/bz2/bz2_filter.c:1.3.2.2Sun Jan  1 12:50:00 2006
+++ php-src/ext/bz2/bz2_filter.cWed Jun 21 15:19:23 2006
@@ -16,7 +16,7 @@
 
+ 
--+

 */
 -/* $Id: bz2_filter.c,v 1.3.2.2 2006/01/01 12:50:00 sniper Exp $ */
+/* $Id: bz2_filter.c,v 1.3.2.2.2.1 2006/06/21 15:19:23 iliaa Exp  
$ */

  #ifdef HAVE_CONFIG_H
 #include config.h
@@ -274,7 +274,7 @@
/* Create this filter */
data = pecalloc(1, sizeof(php_bz2_filter_data), persistent);
if (!data) {
-		php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed allocating % 
d bytes., sizeof(php_bz2_filter_data));
+		php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed allocating % 
ld bytes., sizeof(php_bz2_filter_data));

return NULL;
}



Hi, I don't know what you're running but here size_t is unsigned int.
It's probably unsigned long on 64bit boxen, so what's this fix about?

Regards,
--
Michael

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




Ilia Alshanetsky

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



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

2006-06-21 Thread Andrei Zmievski
andrei  Wed Jun 21 17:10:13 2006 UTC

  Modified files:  
/php-src/main/streams   streams.c 
  Log:
  Typos.
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.125r2=1.126diff_format=u
Index: php-src/main/streams/streams.c
diff -u php-src/main/streams/streams.c:1.125 
php-src/main/streams/streams.c:1.126
--- php-src/main/streams/streams.c:1.125Tue Jun 20 18:09:33 2006
+++ php-src/main/streams/streams.c  Wed Jun 21 17:10:13 2006
@@ -19,7 +19,7 @@
+--+
  */
 
-/* $Id: streams.c,v 1.125 2006/06/20 18:09:33 bjori Exp $ */
+/* $Id: streams.c,v 1.126 2006/06/21 17:10:13 andrei Exp $ */
 
 #define _GNU_SOURCE
 #include php.h
@@ -1221,7 +1221,7 @@
/* Use runtime_encoding to map to binary */
num_conv = 
zend_convert_from_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), str, 
len, buf.u, buflen, status);
if (U_FAILURE(status)) {
-   zend_raise_conversion_error_ex(Unable to convert data 
to be writen, ZEND_U_CONVERTER(UG(runtime_encoding_conv)),
+   zend_raise_conversion_error_ex(Unable to convert data 
to be written, ZEND_U_CONVERTER(UG(runtime_encoding_conv)),

ZEND_FROM_UNICODE, num_conv, (UG(from_error_mode)  ZEND_CONV_ERROR_EXCEPTION) 
TSRMLS_CC);
} else {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, %d 
character unicode buffer downcoded for binary stream runtime_encoding, ulen);
@@ -1579,7 +1579,7 @@
if (U_FAILURE(status)) {
/* Memory overflow isn't a problem becuase 
MAX_BYTES_FOR_STRING was allocated,
   anything else is a more serious problem */
-   zend_raise_conversion_error_ex(Unable to 
convert unicode character using output_encoding, at least one character was 
lost,
+   zend_raise_conversion_error_ex(Unable to 
convert Unicode character using output_encoding, at least one character was 
lost,
conv, 
ZEND_FROM_UNICODE, len, (UG(from_error_mode)  ZEND_CONV_ERROR_EXCEPTION) 
TSRMLS_CC);
}
if (outbuf  outbuf_start) {

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



Re: [PHP-CVS] Re: cvs: php-src(PHP_5_2) /ext/bz2 bz2_filter.c

2006-06-21 Thread Michael Wallner

Stefan Esser wrote:

Hi, I don't know what you're running but here size_t is unsigned int.
It's probably unsigned long on 64bit boxen, so what's this fix about?

The question is: what are you running? size_t usually is unsigned long.


[EMAIL PROTECTED]:~/devel/testimonials$ cat printf.c
#include stdio.h

int main(int argc, char *argv[]) {
   char tmp[3];
   size_t szo = sizeof(tmp);

   printf(%d %u %ld %lu\n, sizeof(tmp), sizeof(tmp), sizeof(tmp), 
sizeof(tmp));
   printf(%d %u %ld %lu\n, szo, szo, szo, szo);
   return 0;
}
[EMAIL PROTECTED]:~/devel/testimonials$ gcc -o printf -Wall printf.c
printf.c: In function ‘main’:
printf.c:7: warning: format ‘%ld’ expects type ‘long int’, but argument 4 has 
type ‘unsigned int’
printf.c:7: warning: format ‘%lu’ expects type ‘long unsigned int’, but 
argument 5 has type ‘unsigned int’
printf.c:8: warning: format ‘%ld’ expects type ‘long int’, but argument 4 has 
type ‘size_t’
printf.c:8: warning: format ‘%lu’ expects type ‘long unsigned int’, but 
argument 5 has type ‘size_t’
[EMAIL PROTECTED]:~/devel/testimonials$ gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v 
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr 
--enable-shared --with-system-zlib --libexecdir=/usr/lib 
--without-included-gettext --enable-threads=posix --enable-nls 
--program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-java-awt=gtk-default --enable-gtk-cairo 
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr 
--disable-werror --with-tune=pentium4 --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
[EMAIL PROTECTED]:~/devel/testimonials$ uname -a
Linux honeybadger 2.6.15-23-686 #1 SMP PREEMPT Tue May 23 14:03:07 UTC 2006 
i686 GNU/Linux

I'm running nothing uncommon, I guess?

Regards,
--
Michael

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



[PHP-CVS] cvs: php-src /ext/unicode unicode.c /main/streams filter.c streams.c ZendEngine2 zend_constants.c zend_unicode.c zend_unicode.h

2006-06-21 Thread Andrei Zmievski
andrei  Wed Jun 21 20:17:21 2006 UTC

  Modified files:  
/ZendEngine2zend_constants.c zend_unicode.c zend_unicode.h 
/php-src/ext/unicodeunicode.c 
/php-src/main/streams   filter.c streams.c 
  Log:
  Implement user conversion error handler support. Works as normal error
  handler, in that it can return false to make the default one take over.
  Handler signature is:
user_handler($direction, $encoding, $char_byte, $offset, $message)
  
  Also removed support for using exceptions in default error handler.
  
  http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_constants.c?r1=1.86r2=1.87diff_format=u
Index: ZendEngine2/zend_constants.c
diff -u ZendEngine2/zend_constants.c:1.86 ZendEngine2/zend_constants.c:1.87
--- ZendEngine2/zend_constants.c:1.86   Sun Mar 26 01:48:33 2006
+++ ZendEngine2/zend_constants.cWed Jun 21 20:17:21 2006
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: zend_constants.c,v 1.86 2006/03/26 01:48:33 andrei Exp $ */
+/* $Id: zend_constants.c,v 1.87 2006/06/21 20:17:21 andrei Exp $ */
 
 #include zend.h
 #include zend_constants.h
@@ -124,7 +124,6 @@
REGISTER_MAIN_LONG_CONSTANT(U_CONV_ERROR_ESCAPE_JAVA, 
ZEND_CONV_ERROR_ESCAPE_JAVA, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT(U_CONV_ERROR_ESCAPE_XML_DEC, 
ZEND_CONV_ERROR_ESCAPE_XML_DEC, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT(U_CONV_ERROR_ESCAPE_XML_HEX, 
ZEND_CONV_ERROR_ESCAPE_XML_HEX, CONST_PERSISTENT | CONST_CS);
-   REGISTER_MAIN_LONG_CONSTANT(U_CONV_ERROR_EXCEPTION, 
ZEND_CONV_ERROR_EXCEPTION, CONST_PERSISTENT | CONST_CS);
 
REGISTER_MAIN_LONG_CONSTANT(FROM_UNICODE, ZEND_FROM_UNICODE, 
CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT(TO_UNICODE, ZEND_TO_UNICODE, 
CONST_PERSISTENT | CONST_CS);
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_unicode.c?r1=1.22r2=1.23diff_format=u
Index: ZendEngine2/zend_unicode.c
diff -u ZendEngine2/zend_unicode.c:1.22 ZendEngine2/zend_unicode.c:1.23
--- ZendEngine2/zend_unicode.c:1.22 Thu May  4 21:22:17 2006
+++ ZendEngine2/zend_unicode.c  Wed Jun 21 20:17:21 2006
@@ -390,8 +390,8 @@
 }
 /* }}} */
 
-/* {{{ zend_raise_conversion_error_ex */
-ZEND_API void zend_raise_conversion_error_ex(char *message, UConverter *conv, 
zend_conv_direction dir, int error_char_offset, int use_exception TSRMLS_DC)
+/* {{{ zend_default_conversion_error_handler */
+static void zend_default_conversion_error_handler(char *message, UConverter 
*conv, zend_conv_direction dir, int error_char_offset TSRMLS_DC)
 {
const char *conv_name;
UErrorCode status = U_ZERO_ERROR;
@@ -399,15 +399,6 @@
if (!message)
return;
 
-   if (!conv) {
-   if (use_exception) {
-   zend_throw_exception_ex(unicodeConversionException, 0 
TSRMLS_CC, %s, message);
-   } else {
-   zend_error(E_WARNING, %s, message);
-   }
-   return;
-   }
-
conv_name = ucnv_getName(conv, status);
/*
 * UTODO
@@ -426,11 +417,7 @@
ucnv_getInvalidUChars(conv, err_char, err_char_len, status);
codepoint = (err_char_len  2) ? err_char[0] : 
U16_GET_SUPPLEMENTARY(err_char[0], err_char[1]);
 
-   if (use_exception) {
-   zend_throw_exception_ex(unicodeConversionException, 0 
TSRMLS_CC, message_fmt, message, conv_name?conv_name:unknown, codepoint, 
error_char_offset-1);
-   } else {
-   zend_error(E_WARNING, message_fmt, message, 
conv_name?conv_name:, codepoint, error_char_offset-1);
-   }
+   zend_error(E_WARNING, message_fmt, message, 
conv_name?conv_name:, codepoint, error_char_offset-1);
} else {
char err_char[8]; /* UTF-8 uses up to 8 bytes */
char buf[32]; /* 4x number of error bytes */
@@ -446,11 +433,106 @@
p += 5;
}
 
-   if (use_exception) {
-   zend_throw_exception_ex(unicodeConversionException, 0 
TSRMLS_CC, message_fmt, message, conv_name?conv_name:unknown, buf, 
error_char_offset-err_char_len);
-   } else {
-   zend_error(E_WARNING, message_fmt, message, 
conv_name?conv_name:, buf, error_char_offset-err_char_len);
+   zend_error(E_WARNING, message_fmt, message, 
conv_name?conv_name:, buf, error_char_offset-err_char_len);
+   }
+}
+/* }}} */
+
+/* {{{ zend_call_conversion_error_handler */
+static void zend_call_conversion_error_handler(char *message, UConverter 
*conv, zend_conv_direction dir, int error_char_offset TSRMLS_DC)
+{
+   zval *z_message, *z_dir, *z_encoding, *z_char, *z_offset;
+   zval ***params;
+   zval *retval;
+   zval *orig_user_error_handler;
+   const char *conv_name;
+   UErrorCode 

Re: [PHP-CVS] Re: cvs: php-src(PHP_5_2) /ext/bz2 bz2_filter.c

2006-06-21 Thread Michael Wallner

Ilia Alshanetsky wrote:
On my 2 32 bit machines the compiler complains about int being used 
where a non-int or a long value is returned. Changing it to long fixes 
the problem, this is replicated on gcc 3.4 and 4.0.1


Ok, well... this seems to differ for me on i686 
(__SIZE_TYPE__ is unsigned int here) and is probably

the reason why PHPs *printf has the %zu format for size_t.

Regards,
--
Michael

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



[PHP-CVS] Re: cvs: php-src(PHP_5_2) /main/streams streams.c

2006-06-21 Thread Nuno Lopes

Hi,


 @@ -1216,7 +1216,7 @@

   p = php_stream_mmap_range(src, php_stream_tell(src), 
 maxlen, PHP_STREAM_MAP_MODE_SHARED_READONLY, mapped);


 - if (p) {
 + if (p  mapped) {
   *buf = pemalloc_rel_orig(mapped + 1, persistent);

   if (*buf) {



I don't think this fix is correct. With your patch, PHP will do more 2 
syscalls without any reason (because PHP will try to read the file again).
Anyway, I don't get any memory leak without your patch (at least with PHP 
5.2). And take a look at _php_stream_passthru() or 
_php_stream_copy_to_stream(). If your patch is correct, these function would 
also need to be patched. Again, I get zero leaks.


Nuno 


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