[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/Zend/tests/bug53971.phpt branches/PHP_5_3/Zend/zend_execute.c trunk/Zend/tests/bug53971.phpt trunk/Zend/zend_execute.c
dmitry Mon, 14 Feb 2011 08:46:53 + Revision: http://svn.php.net/viewvc?view=revisionrevision=308315 Log: Fixed Bug #53971 (isset() and empty() produce apparently spurious runtime error) Bug: http://bugs.php.net/53971 (Assigned) isset() and empty() produce apparently spurious runtime error Changed paths: U php/php-src/branches/PHP_5_3/NEWS A php/php-src/branches/PHP_5_3/Zend/tests/bug53971.phpt U php/php-src/branches/PHP_5_3/Zend/zend_execute.c A php/php-src/trunk/Zend/tests/bug53971.phpt U php/php-src/trunk/Zend/zend_execute.c Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-02-14 06:53:25 UTC (rev 308314) +++ php/php-src/branches/PHP_5_3/NEWS 2011-02-14 08:46:53 UTC (rev 308315) @@ -8,6 +8,8 @@ . Indirect reference to $this fails to resolve if direct $this is never used in method. (Scott) . Added options to debug backtrace functions. (Stas) + . Fixed Bug #53971 (isset() and empty() produce apparently spurious runtime +error). (Dmitry) . Fixed Bug #53629 (memory leak inside highlight_string()). (Hannes, Ilia) . Fixed Bug #51458 (Lack of error context with nested exceptions). (Stas) . Fixed Bug #47143 (Throwing an exception in a destructor causes a fatal Added: php/php-src/branches/PHP_5_3/Zend/tests/bug53971.phpt === --- php/php-src/branches/PHP_5_3/Zend/tests/bug53971.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/Zend/tests/bug53971.phpt 2011-02-14 08:46:53 UTC (rev 308315) @@ -0,0 +1,11 @@ +--TEST-- +Bug #53971 (isset() and empty() produce apparently spurious runtime error) +--FILE-- +?php +$s = ; +var_dump(isset($s[0][0])); +? +--EXPECT-- +bool(false) + + Modified: php/php-src/branches/PHP_5_3/Zend/zend_execute.c === --- php/php-src/branches/PHP_5_3/Zend/zend_execute.c2011-02-14 06:53:25 UTC (rev 308314) +++ php/php-src/branches/PHP_5_3/Zend/zend_execute.c2011-02-14 08:46:53 UTC (rev 308315) @@ -1067,7 +1067,7 @@ dim = tmp; } if (result) { - if (Z_LVAL_P(dim) 0 || Z_STRLEN_P(container) = Z_LVAL_P(dim)) { + if ((Z_LVAL_P(dim) 0 || Z_STRLEN_P(container) = Z_LVAL_P(dim)) type != BP_VAR_IS) { zend_error(E_NOTICE, Uninitialized string offset: %ld, Z_LVAL_P(dim)); } result-str_offset.str = container; Added: php/php-src/trunk/Zend/tests/bug53971.phpt === --- php/php-src/trunk/Zend/tests/bug53971.phpt (rev 0) +++ php/php-src/trunk/Zend/tests/bug53971.phpt 2011-02-14 08:46:53 UTC (rev 308315) @@ -0,0 +1,11 @@ +--TEST-- +Bug #53971 (isset() and empty() produce apparently spurious runtime error) +--FILE-- +?php +$s = ; +var_dump(isset($s[0][0])); +? +--EXPECT-- +bool(false) + + Modified: php/php-src/trunk/Zend/zend_execute.c === --- php/php-src/trunk/Zend/zend_execute.c 2011-02-14 06:53:25 UTC (rev 308314) +++ php/php-src/trunk/Zend/zend_execute.c 2011-02-14 08:46:53 UTC (rev 308315) @@ -1258,7 +1258,9 @@ Z_TYPE_P(ptr) = IS_STRING; if (Z_LVAL_P(dim) 0 || Z_STRLEN_P(container) = Z_LVAL_P(dim)) { - zend_error(E_NOTICE, Uninitialized string offset: %ld, Z_LVAL_P(dim)); + if (type != BP_VAR_IS) { + zend_error(E_NOTICE, Uninitialized string offset: %ld, Z_LVAL_P(dim)); + } Z_STRVAL_P(ptr) = STR_EMPTY_ALLOC(); Z_STRLEN_P(ptr) = 0; } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/exif/exif.c branches/PHP_5_3/ext/exif/tests/bug54002.phpt branches/PHP_5_3/ext/exif/tests/bug54002_1.jpeg branches/PHP_5_3/ext/exif/tests/bug54002_2.j
pajoye Mon, 14 Feb 2011 09:08:44 + Revision: http://svn.php.net/viewvc?view=revisionrevision=308316 Log: - fix bug #54002, exif_read_data crashes on crafted tags Bug: http://bugs.php.net/54002 (error getting bug information) Changed paths: U php/php-src/branches/PHP_5_3/ext/exif/exif.c A php/php-src/branches/PHP_5_3/ext/exif/tests/bug54002.phpt A php/php-src/branches/PHP_5_3/ext/exif/tests/bug54002_1.jpeg A php/php-src/branches/PHP_5_3/ext/exif/tests/bug54002_2.jpeg U php/php-src/trunk/ext/exif/exif.c A php/php-src/trunk/ext/exif/tests/bug54002.phpt A php/php-src/trunk/ext/exif/tests/bug54002_1.jpeg A php/php-src/trunk/ext/exif/tests/bug54002_2.jpeg Modified: php/php-src/branches/PHP_5_3/ext/exif/exif.c === --- php/php-src/branches/PHP_5_3/ext/exif/exif.c2011-02-14 08:46:53 UTC (rev 308315) +++ php/php-src/branches/PHP_5_3/ext/exif/exif.c2011-02-14 09:08:44 UTC (rev 308316) @@ -40,6 +40,10 @@ #include php.h #include ext/standard/file.h +#ifdef PHP_WIN32 +include win32/php_stdint.h +#endif + #if HAVE_EXIF /* When EXIF_DEBUG is defined the module generates a lot of debug messages @@ -2821,6 +2825,7 @@ int tag, format, components; char *value_ptr, tagname[64], cbuf[32], *outside=NULL; size_t byte_count, offset_val, fpos, fgot; + int64_t byte_count_signed; xp_field_type *tmp_xp; #ifdef EXIF_DEBUG char *dump_data; @@ -2845,13 +2850,20 @@ /*return TRUE;*/ } - byte_count = components * php_tiff_bytes_per_format[format]; + if (components 0) { + exif_error_docref(exif_read_data#error_ifd EXIFERR_CC, ImageInfo, E_WARNING, Process tag(x%04X=%s): Illegal byte_count(%ld), tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), byte_count); + return FALSE; + } - if ((ssize_t)byte_count 0) { + byte_count_signed = (int64_t)components * php_tiff_bytes_per_format[format]; + + if (byte_count_signed 0 || (byte_count_signed 2147483648)) { exif_error_docref(exif_read_data#error_ifd EXIFERR_CC, ImageInfo, E_WARNING, Process tag(x%04X=%s): Illegal byte_count(%ld), tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), byte_count); return FALSE; } + byte_count = (size_t)byte_count_signed; + if (byte_count 4) { offset_val = php_ifd_get32u(dir_entry+8, ImageInfo-motorola_intel); /* If its bigger than 4 bytes, the dir entry contains an offset. */ @@ -2916,6 +2928,7 @@ efree(dump_data); } #endif + if (section_index==SECTION_THUMBNAIL) { if (!ImageInfo-Thumbnail.data) { switch(tag) { Added: php/php-src/branches/PHP_5_3/ext/exif/tests/bug54002.phpt === --- php/php-src/branches/PHP_5_3/ext/exif/tests/bug54002.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/exif/tests/bug54002.phpt 2011-02-14 09:08:44 UTC (rev 308316) @@ -0,0 +1,20 @@ +--TEST-- +Bug #54002 (crash on crafted tag) +--INI-- +memory_limit=-1 +--SKIPIF-- +?php if (!extension_loaded('exif')) print 'skip exif extension not available';? +--FILE-- +?php +exif_read_data(__DIR__ . '/bug54002_1.jpeg'); +exif_read_data(__DIR__ . '/bug54002_2.jpeg'); + +? +--EXPECTF-- +Warning: exif_read_data(bug54002_1.jpeg): Process tag(x0205=UndefinedTa): Illegal byte_count(8) in %sbug54002.php on line %d + +Warning: exif_read_data(bug54002_1.jpeg): Process tag(xA000=FlashPixVer): Illegal pointer offset(%s) in %sbug54002.php on line %d + +Warning: exif_read_data(bug54002_2.jpeg): Process tag(x0205=UndefinedTa): Illegal byte_count(8) in %sbug54002.php on line %d + +Warning: exif_read_data(bug54002_2.jpeg): Process tag(xA000=FlashPixVer): Illegal pointer offset(%s) in %sbug54002.php on line %d Added: php/php-src/branches/PHP_5_3/ext/exif/tests/bug54002_1.jpeg === (Binary files differ) Property changes on: php/php-src/branches/PHP_5_3/ext/exif/tests/bug54002_1.jpeg ___ Added: svn:mime-type + application/octet-stream Added: php/php-src/branches/PHP_5_3/ext/exif/tests/bug54002_2.jpeg === (Binary files differ) Property changes on: php/php-src/branches/PHP_5_3/ext/exif/tests/bug54002_2.jpeg ___ Added: svn:mime-type + application/octet-stream Modified: php/php-src/trunk/ext/exif/exif.c === --- php/php-src/trunk/ext/exif/exif.c 2011-02-14 08:46:53 UTC (rev 308315) +++
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/exif/exif.c branches/PHP_5_3/ext/exif/tests/bug54002.phpt trunk/ext/exif/exif.c trunk/ext/exif/tests/bug54002.phpt
pajoye Mon, 14 Feb 2011 09:40:10 + Revision: http://svn.php.net/viewvc?view=revisionrevision=308317 Log: -Bug #54002, fix windows build, use the relevant values in the warnings Bug: http://bugs.php.net/54002 (error getting bug information) Changed paths: U php/php-src/branches/PHP_5_3/ext/exif/exif.c U php/php-src/branches/PHP_5_3/ext/exif/tests/bug54002.phpt U php/php-src/trunk/ext/exif/exif.c U php/php-src/trunk/ext/exif/tests/bug54002.phpt Modified: php/php-src/branches/PHP_5_3/ext/exif/exif.c === --- php/php-src/branches/PHP_5_3/ext/exif/exif.c2011-02-14 09:08:44 UTC (rev 308316) +++ php/php-src/branches/PHP_5_3/ext/exif/exif.c2011-02-14 09:40:10 UTC (rev 308317) @@ -41,7 +41,7 @@ #include ext/standard/file.h #ifdef PHP_WIN32 -include win32/php_stdint.h +#include win32/php_stdint.h #endif #if HAVE_EXIF @@ -2851,14 +2851,14 @@ } if (components 0) { - exif_error_docref(exif_read_data#error_ifd EXIFERR_CC, ImageInfo, E_WARNING, Process tag(x%04X=%s): Illegal byte_count(%ld), tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), byte_count); + exif_error_docref(exif_read_data#error_ifd EXIFERR_CC, ImageInfo, E_WARNING, Process tag(x%04X=%s): Illegal components(%ld), tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), components); return FALSE; } byte_count_signed = (int64_t)components * php_tiff_bytes_per_format[format]; if (byte_count_signed 0 || (byte_count_signed 2147483648)) { - exif_error_docref(exif_read_data#error_ifd EXIFERR_CC, ImageInfo, E_WARNING, Process tag(x%04X=%s): Illegal byte_count(%ld), tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), byte_count); + exif_error_docref(exif_read_data#error_ifd EXIFERR_CC, ImageInfo, E_WARNING, Process tag(x%04X=%s): Illegal byte_count, tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC)); return FALSE; } Modified: php/php-src/branches/PHP_5_3/ext/exif/tests/bug54002.phpt === --- php/php-src/branches/PHP_5_3/ext/exif/tests/bug54002.phpt 2011-02-14 09:08:44 UTC (rev 308316) +++ php/php-src/branches/PHP_5_3/ext/exif/tests/bug54002.phpt 2011-02-14 09:40:10 UTC (rev 308317) @@ -11,10 +11,10 @@ ? --EXPECTF-- -Warning: exif_read_data(bug54002_1.jpeg): Process tag(x0205=UndefinedTa): Illegal byte_count(8) in %sbug54002.php on line %d +Warning: exif_read_data(bug54002_1.jpeg): Process tag(x0205=UndefinedTa): Illegal byte_count in %sbug54002.php on line %d Warning: exif_read_data(bug54002_1.jpeg): Process tag(xA000=FlashPixVer): Illegal pointer offset(%s) in %sbug54002.php on line %d -Warning: exif_read_data(bug54002_2.jpeg): Process tag(x0205=UndefinedTa): Illegal byte_count(8) in %sbug54002.php on line %d +Warning: exif_read_data(bug54002_2.jpeg): Process tag(x0205=UndefinedTa): Illegal byte_count in %sbug54002.php on line %d Warning: exif_read_data(bug54002_2.jpeg): Process tag(xA000=FlashPixVer): Illegal pointer offset(%s) in %sbug54002.php on line %d Modified: php/php-src/trunk/ext/exif/exif.c === --- php/php-src/trunk/ext/exif/exif.c 2011-02-14 09:08:44 UTC (rev 308316) +++ php/php-src/trunk/ext/exif/exif.c 2011-02-14 09:40:10 UTC (rev 308317) @@ -41,7 +41,7 @@ #include ext/standard/file.h #ifdef PHP_WIN32 -include win32/php_stdint.h +#include win32/php_stdint.h #endif #if HAVE_EXIF @@ -2847,13 +2847,14 @@ } if (components 0) { - exif_error_docref(exif_read_data#error_ifd EXIFERR_CC, ImageInfo, E_WARNING, Process tag(x%04X=%s): Illegal byte_count(%ld), tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), byte_count); + exif_error_docref(exif_read_data#error_ifd EXIFERR_CC, ImageInfo, E_WARNING, Process tag(x%04X=%s): Illegal components(%ld), tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), components); return FALSE; } + byte_count_signed = (int64_t)components * php_tiff_bytes_per_format[format]; if (byte_count_signed 0 || (byte_count_signed 2147483648)) { - exif_error_docref(exif_read_data#error_ifd EXIFERR_CC, ImageInfo, E_WARNING, Process tag(x%04X=%s): Illegal byte_count(%ld), tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), byte_count); + exif_error_docref(exif_read_data#error_ifd EXIFERR_CC, ImageInfo, E_WARNING, Process tag(x%04X=%s): Illegal byte_count, tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC)); return FALSE; } Modified: php/php-src/trunk/ext/exif/tests/bug54002.phpt === ---
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/Zend/tests/bug53958.phpt branches/PHP_5_3/Zend/zend_closures.c trunk/Zend/tests/bug53958.phpt trunk/Zend/zend_variables.c
dmitry Mon, 14 Feb 2011 10:52:16 + Revision: http://svn.php.net/viewvc?view=revisionrevision=308320 Log: Fixed Bug #53958 (Closures can't 'use' shared variables by value and by reference) Bug: http://bugs.php.net/53958 (Assigned) Closures can't 'use' shared variables by value and by reference Changed paths: U php/php-src/branches/PHP_5_3/NEWS A php/php-src/branches/PHP_5_3/Zend/tests/bug53958.phpt U php/php-src/branches/PHP_5_3/Zend/zend_closures.c A php/php-src/trunk/Zend/tests/bug53958.phpt U php/php-src/trunk/Zend/zend_variables.c Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-02-14 10:10:52 UTC (rev 308319) +++ php/php-src/branches/PHP_5_3/NEWS 2011-02-14 10:52:16 UTC (rev 308320) @@ -10,6 +10,8 @@ . Added options to debug backtrace functions. (Stas) . Fixed Bug #53971 (isset() and empty() produce apparently spurious runtime error). (Dmitry) + . Fixed Bug #53958 (Closures can't 'use' shared variables by value and by +reference). (Dmitry) . Fixed Bug #53629 (memory leak inside highlight_string()). (Hannes, Ilia) . Fixed Bug #51458 (Lack of error context with nested exceptions). (Stas) . Fixed Bug #47143 (Throwing an exception in a destructor causes a fatal Added: php/php-src/branches/PHP_5_3/Zend/tests/bug53958.phpt === --- php/php-src/branches/PHP_5_3/Zend/tests/bug53958.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/Zend/tests/bug53958.phpt 2011-02-14 10:52:16 UTC (rev 308320) @@ -0,0 +1,61 @@ +--TEST-- +Bug #53958 (Closures can't 'use' shared variables by value and by reference) +--FILE-- +?php +// TEST 1 +$a = 1; +$fn1 = function() use ($a) {echo $a\n; $a++;}; +$fn2 = function() use ($a) {echo $a\n; $a++;}; +$a = 5; +$fn1(); // 1 +$fn2(); // 1 +$fn1(); // 1 +$fn2(); // 1 + +// TEST 2 +$b = 1; +$fn1 = function() use ($b) {echo $b\n; $b++;}; +$fn2 = function() use ($b) {echo $b\n; $b++;}; +$b = 5; +$fn1(); // 5 +$fn2(); // 6 +$fn1(); // 7 +$fn2(); // 8 + +// TEST 3 +$c = 1; +$fn1 = function() use ($c) {echo $c\n; $c++;}; +$fn2 = function() use ($c) {echo $c\n; $c++;}; +$c = 5; +$fn1(); // 5 +$fn2(); // 1 +$fn1(); // 6 +$fn2(); // 1 + +// TEST 4 +$d = 1; +$fn1 = function() use ($d) {echo $d\n; $d++;}; +$fn2 = function() use ($d) {echo $d\n; $d++;}; +$d = 5; +$fn1(); // 1 +$fn2(); // 5 +$fn1(); // 1 +$fn2(); // 6 +? +--EXPECT-- +1 +1 +1 +1 +5 +6 +7 +8 +5 +1 +6 +1 +1 +5 +1 +6 Modified: php/php-src/branches/PHP_5_3/Zend/zend_closures.c === --- php/php-src/branches/PHP_5_3/Zend/zend_closures.c 2011-02-14 10:10:52 UTC (rev 308319) +++ php/php-src/branches/PHP_5_3/Zend/zend_closures.c 2011-02-14 10:52:16 UTC (rev 308320) @@ -323,6 +323,7 @@ { HashTable *target = va_arg(args, HashTable*); zend_bool is_ref; + zval *tmp; if (Z_TYPE_PP(p) (IS_LEXICAL_VAR|IS_LEXICAL_REF)) { is_ref = Z_TYPE_PP(p) IS_LEXICAL_REF; @@ -332,25 +333,31 @@ } if (zend_hash_quick_find(EG(active_symbol_table), key-arKey, key-nKeyLength, key-h, (void **) p) == FAILURE) { if (is_ref) { - zval *tmp; - ALLOC_INIT_ZVAL(tmp); Z_SET_ISREF_P(tmp); zend_hash_quick_add(EG(active_symbol_table), key-arKey, key-nKeyLength, key-h, tmp, sizeof(zval*), (void**)p); } else { - p = EG(uninitialized_zval_ptr); + tmp = EG(uninitialized_zval_ptr); zend_error(E_NOTICE,Undefined variable: %s, key-arKey); } } else { if (is_ref) { SEPARATE_ZVAL_TO_MAKE_IS_REF(p); + tmp = *p; } else if (Z_ISREF_PP(p)) { - SEPARATE_ZVAL(p); + ALLOC_INIT_ZVAL(tmp); + *tmp = **p; + Z_SET_REFCOUNT_P(tmp, 0); + Z_UNSET_ISREF_P(tmp); + } else { + tmp = *p; } } + } else { + tmp = *p; } - if (zend_hash_quick_add(target, key-arKey, key-nKeyLength, key-h, p, sizeof(zval*), NULL) == SUCCESS) { - Z_ADDREF_PP(p); + if (zend_hash_quick_add(target, key-arKey, key-nKeyLength, key-h, tmp, sizeof(zval*), NULL) == SUCCESS) { + Z_ADDREF_P(tmp); } return ZEND_HASH_APPLY_KEEP; } Added:
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysql/php_mysql.c trunk/ext/mysql/php_mysql.c
iliaaMon, 14 Feb 2011 14:05:46 + Revision: http://svn.php.net/viewvc?view=revisionrevision=308323 Log: Fixed variable re-declarations Changed paths: U php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c U php/php-src/trunk/ext/mysql/php_mysql.c Modified: php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c === --- php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c 2011-02-14 13:58:03 UTC (rev 308322) +++ php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c 2011-02-14 14:05:46 UTC (rev 308323) @@ -371,11 +371,11 @@ if (mysql-active_result_id) { \ do {\ int type; \ - MYSQL_RES *mysql_result;\ + MYSQL_RES *_mysql_result; \ \ - mysql_result = (MYSQL_RES *) zend_list_find(mysql-active_result_id, type);\ - if (mysql_result type==le_result) { \ - if (mysql_result_is_unbuffered(mysql_result) !mysql_eof(mysql_result)) { \ + _mysql_result = (MYSQL_RES *) zend_list_find(mysql-active_result_id, type); \ + if (_mysql_result type==le_result) { \ + if (mysql_result_is_unbuffered(_mysql_result) !mysql_eof(_mysql_result)) { \ php_error_docref(NULL TSRMLS_CC, E_NOTICE, Function called without first fetching all rows from a previous unbuffered query); \ } \ zend_list_delete(mysql-active_result_id); \ @@ -2126,12 +2126,12 @@ fci.retval_ptr_ptr = retval_ptr; if (ctor_params Z_TYPE_P(ctor_params) != IS_NULL) { if (Z_TYPE_P(ctor_params) == IS_ARRAY) { - HashTable *ht = Z_ARRVAL_P(ctor_params); + HashTable *htl = Z_ARRVAL_P(ctor_params); Bucket *p; fci.param_count = 0; - fci.params = safe_emalloc(sizeof(zval*), ht-nNumOfElements, 0); - p = ht-pListHead; + fci.params = safe_emalloc(sizeof(zval*), htl-nNumOfElements, 0); + p = htl-pListHead; while (p != NULL) { fci.params[fci.param_count++] = (zval**)p-pData; p = p-pListNext; Modified: php/php-src/trunk/ext/mysql/php_mysql.c === --- php/php-src/trunk/ext/mysql/php_mysql.c 2011-02-14 13:58:03 UTC (rev 308322) +++ php/php-src/trunk/ext/mysql/php_mysql.c 2011-02-14 14:05:46 UTC (rev 308323) @@ -371,11 +371,11 @@ if (mysql-active_result_id) { \ do {\ int type; \ - MYSQL_RES *mysql_result;\ + MYSQL_RES *_mysql_result; \ \ - mysql_result = (MYSQL_RES *) zend_list_find(mysql-active_result_id, type);\ - if (mysql_result type==le_result) { \ - if (mysql_result_is_unbuffered(mysql_result) !mysql_eof(mysql_result)) { \ + _mysql_result = (MYSQL_RES *) zend_list_find(mysql-active_result_id, type); \ + if (_mysql_result type==le_result) { \ + if (mysql_result_is_unbuffered(_mysql_result) !mysql_eof(_mysql_result)) { \ php_error_docref(NULL TSRMLS_CC, E_NOTICE, Function called without first fetching all rows from a previous unbuffered query); \ } \ zend_list_delete(mysql-active_result_id); \ @@ -2126,12 +2126,12 @@ fci.retval_ptr_ptr = retval_ptr; if (ctor_params Z_TYPE_P(ctor_params) != IS_NULL) { if (Z_TYPE_P(ctor_params) == IS_ARRAY) { - HashTable *ht = Z_ARRVAL_P(ctor_params); + HashTable *htl =
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/fileinfo/fileinfo.c branches/PHP_5_3/ext/fileinfo/tests/finfo_file_001.phpt branches/PHP_5_3/ext/fileinfo/tests/finfo_file_002.phpt branches/PHP_5_3/e
bjoriMon, 14 Feb 2011 15:32:02 + Revision: http://svn.php.net/viewvc?view=revisionrevision=308327 Log: Bug#54016 (finfo_file() Cannot determine filetype in archives) Bug: http://bugs.php.net/54016 (Assigned) finfo_file: Cannot determine filetype in archives Changed paths: U php/php-src/branches/PHP_5_3/ext/fileinfo/fileinfo.c U php/php-src/branches/PHP_5_3/ext/fileinfo/tests/finfo_file_001.phpt U php/php-src/branches/PHP_5_3/ext/fileinfo/tests/finfo_file_002.phpt A php/php-src/branches/PHP_5_3/ext/fileinfo/tests/finfo_file_stream_001.phpt U php/php-src/branches/PHP_5_3/ext/fileinfo/tests/mime_content_type_001.phpt A php/php-src/branches/PHP_5_3/ext/fileinfo/tests/resources/dir.zip U php/php-src/trunk/ext/fileinfo/fileinfo.c U php/php-src/trunk/ext/fileinfo/tests/finfo_file_001.phpt U php/php-src/trunk/ext/fileinfo/tests/finfo_file_002.phpt A php/php-src/trunk/ext/fileinfo/tests/finfo_file_stream_001.phpt U php/php-src/trunk/ext/fileinfo/tests/mime_content_type_001.phpt A php/php-src/trunk/ext/fileinfo/tests/resources/dir.zip Modified: php/php-src/branches/PHP_5_3/ext/fileinfo/fileinfo.c === --- php/php-src/branches/PHP_5_3/ext/fileinfo/fileinfo.c 2011-02-14 15:20:37 UTC (rev 308326) +++ php/php-src/branches/PHP_5_3/ext/fileinfo/fileinfo.c 2011-02-14 15:32:02 UTC (rev 308327) @@ -478,7 +478,7 @@ /* determine if the file is a local file or remote URL */ char *tmp2; php_stream_wrapper *wrap; - struct stat sb; + php_stream_statbuf ssb; if (buffer == NULL || !*buffer) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Empty filename or path); @@ -486,17 +486,6 @@ goto clean; } - 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); if (wrap) { @@ -512,7 +501,14 @@ goto clean; } -ret_val = (char *)magic_stream(magic, stream); +if (php_stream_stat(stream, ssb) == SUCCESS) { + if (ssb.sb.st_mode S_IFDIR) { + ret_val = mime_directory; + } else { + ret_val = (char *)magic_stream(magic, stream); + } +} + php_stream_close(stream); } break; Modified: php/php-src/branches/PHP_5_3/ext/fileinfo/tests/finfo_file_001.phpt === --- php/php-src/branches/PHP_5_3/ext/fileinfo/tests/finfo_file_001.phpt 2011-02-14 15:20:37 UTC (rev 308326) +++ php/php-src/branches/PHP_5_3/ext/fileinfo/tests/finfo_file_001.phpt 2011-02-14 15:32:02 UTC (rev 308327) @@ -24,5 +24,5 @@ bool(false) string(9) directory -Warning: finfo_file(): File or path not found '' in %s on line %d +Warning: finfo_file(): failed to open stream: No such file or directory in %s on line %d bool(false) Modified: php/php-src/branches/PHP_5_3/ext/fileinfo/tests/finfo_file_002.phpt === --- php/php-src/branches/PHP_5_3/ext/fileinfo/tests/finfo_file_002.phpt 2011-02-14 15:20:37 UTC (rev 308326) +++ php/php-src/branches/PHP_5_3/ext/fileinfo/tests/finfo_file_002.phpt 2011-02-14 15:32:02 UTC (rev 308327) @@ -18,7 +18,9 @@ var_dump($results); ? --EXPECTF-- -array(5) { +array(6) { + [%s/resources/dir.zip]= + string(15) application/zip [%s/resources/test.bmp]= string(14) image/x-ms-bmp [%s/resources/test.gif]= Added: php/php-src/branches/PHP_5_3/ext/fileinfo/tests/finfo_file_stream_001.phpt === --- php/php-src/branches/PHP_5_3/ext/fileinfo/tests/finfo_file_stream_001.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/fileinfo/tests/finfo_file_stream_001.phpt 2011-02-14 15:32:02 UTC (rev 308327) @@ -0,0 +1,26 @@ +--TEST-- +finfo_file(): Files and directories inside an stream +--SKIPIF-- +?php require_once(dirname(__FILE__) . '/skipif.inc'); ? +?php if (!extension_loaded('zip')) { die(skip); } ? +--FILE-- +?php + +$fp = finfo_open(FILEINFO_MIME_TYPE); +$results = array(); + +$zip = __DIR__ . /resources/dir.zip; +$stream = zip:// . __DIR__ . /resources/dir.zip; +$dir = $stream . #dir/; +$png = $stream . #dir/test.png; + +var_dump( + finfo_file($fp, $zip), + finfo_file($fp, $dir), + finfo_file($fp, $png) +); +? +--EXPECTF-- +string(15) application/zip +string(9) directory +string(9) image/png Modified: php/php-src/branches/PHP_5_3/ext/fileinfo/tests/mime_content_type_001.phpt === --- php/php-src/branches/PHP_5_3/ext/fileinfo/tests/mime_content_type_001.phpt 2011-02-14 15:20:37 UTC (rev
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ NEWS
bjoriMon, 14 Feb 2011 15:34:04 + Revision: http://svn.php.net/viewvc?view=revisionrevision=308328 Log: bfn for #54016 Bug: http://bugs.php.net/54016 (Assigned) finfo_file: Cannot determine filetype in archives Changed paths: U php/php-src/branches/PHP_5_3/NEWS Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-02-14 15:32:02 UTC (rev 308327) +++ php/php-src/branches/PHP_5_3/NEWS 2011-02-14 15:34:04 UTC (rev 308328) @@ -62,6 +62,10 @@ . Fixed bug #47435 (FILTER_FLAG_NO_RES_RANGE don't work with ipv6). (Ilia, valli at icsurselva dot ch) +- Fileinfo extension: + . Fixed bug #54016 (finfo_file() Cannot determine filetype in archives). +(Hannes) + - Gettext . Fixed bug #53837 (_() crashes on Windows when no LANG or LANGUAGE environment variable are set). (Pierre) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/PHP_5_2/ ext/pcntl/pcntl.c ext/pcntl/php_signal.c ext/pcntl/php_signal.h tests/security/open_basedir_parse_ini_file.phpt
lbarnaud Mon, 14 Feb 2011 17:06:31 + Revision: http://svn.php.net/viewvc?view=revisionrevision=308329 Log: MFH fixed bug #52784 (Race condition when handling many concurrent signals) Bug: http://bugs.php.net/52784 (Closed) Race condition when handling many concurrent signals Changed paths: _U php/php-src/branches/PHP_5_2/ _U php/php-src/branches/PHP_5_2/ext/ldap/ U php/php-src/branches/PHP_5_2/ext/pcntl/pcntl.c U php/php-src/branches/PHP_5_2/ext/pcntl/php_signal.c U php/php-src/branches/PHP_5_2/ext/pcntl/php_signal.h _U php/php-src/branches/PHP_5_2/ext/tidy/tests/ _U php/php-src/branches/PHP_5_2/tests/security/open_basedir_parse_ini_file.phpt Property changes on: php/php-src/branches/PHP_5_2 ___ Modified: svn:mergeinfo - /php/php-src/branches/PHP_5_3:284120,288260,288273 /php/php-src/trunk:284726 + /php/php-src/branches/PHP_5_3:284120,288260,288273 /php/php-src/trunk:284726,305018-305019 Property changes on: php/php-src/branches/PHP_5_2/ext/ldap ___ Modified: svn:mergeinfo - /php/php-src/branches/PHP_5_3/ext/ldap:284120 /php/php-src/trunk/ext/ldap:282758,284726 + /php/php-src/branches/PHP_5_3/ext/ldap:284120 /php/php-src/trunk/ext/ldap:282758,284726,305018-305019 Modified: php/php-src/branches/PHP_5_2/ext/pcntl/pcntl.c === --- php/php-src/branches/PHP_5_2/ext/pcntl/pcntl.c 2011-02-14 15:34:04 UTC (rev 308328) +++ php/php-src/branches/PHP_5_2/ext/pcntl/pcntl.c 2011-02-14 17:06:31 UTC (rev 308329) @@ -567,7 +567,7 @@ zend_hash_index_update(PCNTL_G(php_signal_table), signo, (void **) handle, sizeof(zval *), (void **) dest_handle); if (dest_handle) zval_add_ref(dest_handle); - if (php_signal(signo, pcntl_signal_handler, (int) restart_syscalls) == SIG_ERR) { + if (php_signal4(signo, pcntl_signal_handler, (int) restart_syscalls, 1) == SIG_ERR) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Error assigning signal); RETURN_FALSE; } @@ -682,11 +682,19 @@ { zval *param, **handle, *retval; struct php_pcntl_pending_signal *queue, *next; + sigset_t mask; + sigset_t old_mask; TSRMLS_FETCH(); + + /* Mask all signals */ + sigfillset(mask); + sigprocmask(SIG_BLOCK, mask, old_mask); /* Bail if the queue is empty or if we are already playing the queue*/ - if (! PCNTL_G(head) || PCNTL_G(processing_signal_queue)) + if (! PCNTL_G(head) || PCNTL_G(processing_signal_queue)) { + sigprocmask(SIG_SETMASK, old_mask, NULL); return; + } /* Prevent reentrant handler calls */ PCNTL_G(processing_signal_queue) = 1; @@ -718,6 +726,9 @@ /* Re-enable queue */ PCNTL_G(processing_signal_queue) = 0; + + /* return signal mask to previous state */ + sigprocmask(SIG_SETMASK, old_mask, NULL); } Modified: php/php-src/branches/PHP_5_2/ext/pcntl/php_signal.c === --- php/php-src/branches/PHP_5_2/ext/pcntl/php_signal.c 2011-02-14 15:34:04 UTC (rev 308328) +++ php/php-src/branches/PHP_5_2/ext/pcntl/php_signal.c 2011-02-14 17:06:31 UTC (rev 308329) @@ -22,12 +22,15 @@ /* php_signal using sigaction is derrived from Advanced Programing * in the Unix Environment by W. Richard Stevens p 298. */ -Sigfunc *php_signal(int signo, Sigfunc *func, int restart) +Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all) { - struct sigaction act,oact; act.sa_handler = func; - sigemptyset(act.sa_mask); + if (mask_all) { + sigfillset(act.sa_mask); + } else { + sigemptyset(act.sa_mask); + } act.sa_flags = 0; if (signo == SIGALRM || (! restart)) { #ifdef SA_INTERRUPT @@ -44,3 +47,7 @@ return oact.sa_handler; } +Sigfunc *php_signal(int signo, Sigfunc *func, int restart) +{ + return php_signal4(signo, func, restart, 0); +} Modified: php/php-src/branches/PHP_5_2/ext/pcntl/php_signal.h === --- php/php-src/branches/PHP_5_2/ext/pcntl/php_signal.h 2011-02-14 15:34:04 UTC (rev 308328) +++ php/php-src/branches/PHP_5_2/ext/pcntl/php_signal.h 2011-02-14 17:06:31 UTC (rev 308329) @@ -24,5 +24,6 @@ typedef void Sigfunc(int); Sigfunc *php_signal(int signo, Sigfunc *func, int restart); +Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all); #endif Property changes on: php/php-src/branches/PHP_5_2/ext/tidy/tests ___ Modified: svn:mergeinfo - /php/php-src/branches/PHP_5_3/ext/tidy/tests:284120
[PHP-CVS] svn: /php/php-src/trunk/ext/snmp/ snmp.c
felipe Mon, 14 Feb 2011 23:43:22 + Revision: http://svn.php.net/viewvc?view=revisionrevision=308344 Log: - Fixed memory leak Changed paths: U php/php-src/trunk/ext/snmp/snmp.c Modified: php/php-src/trunk/ext/snmp/snmp.c === --- php/php-src/trunk/ext/snmp/snmp.c 2011-02-14 22:59:42 UTC (rev 308343) +++ php/php-src/trunk/ext/snmp/snmp.c 2011-02-14 23:43:22 UTC (rev 308344) @@ -502,6 +502,8 @@ netsnmp_session_free((intern-session)); zend_object_std_dtor(intern-zo TSRMLS_CC); + + efree(intern); } static zend_object_value php_snmp_object_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ext/snmp/ snmp.c
felipe Mon, 14 Feb 2011 23:58:52 + Revision: http://svn.php.net/viewvc?view=revisionrevision=308345 Log: - Fixed memory leak on serialize(new SNMP) Changed paths: U php/php-src/trunk/ext/snmp/snmp.c Modified: php/php-src/trunk/ext/snmp/snmp.c === --- php/php-src/trunk/ext/snmp/snmp.c 2011-02-14 23:43:22 UTC (rev 308344) +++ php/php-src/trunk/ext/snmp/snmp.c 2011-02-14 23:58:52 UTC (rev 308345) @@ -1988,9 +1988,9 @@ while (zend_hash_get_current_data_ex(php_snmp_properties, (void**)hnd, pos) == SUCCESS) { zend_hash_get_current_key_ex(php_snmp_properties, key, key_len, num_key, 0, pos); - MAKE_STD_ZVAL(val); if (!hnd-read_func || hnd-read_func(obj, val TSRMLS_CC) != SUCCESS) { val = EG(uninitialized_zval_ptr); + Z_ADDREF_P(val); } zend_hash_update(props, key, key_len, (void *)val, sizeof(zval *), NULL); zend_hash_move_forward_ex(php_snmp_properties, pos); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ext/snmp/ snmp.c
felipe Tue, 15 Feb 2011 00:07:26 + Revision: http://svn.php.net/viewvc?view=revisionrevision=308346 Log: - Fixed crash on unserialize(serialize(new SNMP)) Changed paths: U php/php-src/trunk/ext/snmp/snmp.c Modified: php/php-src/trunk/ext/snmp/snmp.c === --- php/php-src/trunk/ext/snmp/snmp.c 2011-02-14 23:58:52 UTC (rev 308345) +++ php/php-src/trunk/ext/snmp/snmp.c 2011-02-15 00:07:26 UTC (rev 308346) @@ -2007,6 +2007,10 @@ MAKE_STD_ZVAL(*retval); array_init(*retval); + if (snmp_object-session == NULL) { + return SUCCESS; + } + MAKE_STD_ZVAL(val); ZVAL_STRINGL(val, snmp_object-session-peername, strlen(snmp_object-session-peername), 1); add_assoc_zval(*retval, hostname, val); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php