[PHP-CVS-DAILY] cvs: php-src / ChangeLog
changelog Mon Oct 4 20:35:04 2004 EDT Modified files: /php-srcChangeLog Log: ChangeLog update http://cvs.php.net/diff.php/php-src/ChangeLog?r1=1.1765r2=1.1766ty=u Index: php-src/ChangeLog diff -u php-src/ChangeLog:1.1765 php-src/ChangeLog:1.1766 --- php-src/ChangeLog:1.1765Sun Oct 3 20:34:36 2004 +++ php-src/ChangeLog Mon Oct 4 20:35:04 2004 @@ -1,3 +1,71 @@ +2004-10-04 Ilia Alshanetsky [EMAIL PROTECTED] + +* (PHP_4_3) + NEWS + NEWS + ext/standard/image.c + ext/standard/image.c: + MFH: Fixed bug #30281 (Prevent non-wbmp images from being detected as such) + +* ext/standard/image.c: + Fixed bug #30281 (Prevent non-wbmp images from being detected as such). + +2004-10-04 Andi Gutmans [EMAIL PROTECTED] + +* ZendEngine2/zend_API.h + ZendEngine2/zend_execute_API.c + ext/session/session.c + ext/standard/array.c + ext/standard/basic_functions.c: + - Rename delete_global_variable() to zend_delete_global_variable() + +* ZendEngine2/Zend.m4 + ZendEngine2/zend_API.h + ZendEngine2/zend_compile.c + ZendEngine2/zend_compile.h + ZendEngine2/zend_execute.c + ZendEngine2/zend_execute_API.c + ZendEngine2/zend_language_parser.y + ZendEngine2/zend_opcode.c + ZendEngine2/zend_vm.h + ZendEngine2/zend_vm_handlers.h + ZendEngine2/zend_vm_spec.h + ext/session/session.c + ext/standard/array.c + ext/standard/basic_functions.c: + - Commit the variable fetch optimization. + - Extensions which delete global variables need to use new special + function + - delete_global_variable() (I'm about to rename it) to remove them. + - Will post to internals@ or via commit messages if there's anything else. + +2004-10-04 Marcus Boerger [EMAIL PROTECTED] + +* (PHP_5_0) + NEWS: + BFN + +* ZendEngine2/zend_builtin_functions.c: + - Bugfix #27798 + +* ZendEngine2/tests/bug27798.phpt + ext/standard/tests/array/bug29992.phpt + tests/classes/static_this.phpt: + + - Add new test + +2004-10-04 Anantha Kesari H Y [EMAIL PROTECTED] + +* ext/session/mod_files.c: + modified to 3rd argument of fcntl to FD_CLOEXEC + +2004-10-04 Ilia Alshanetsky [EMAIL PROTECTED] + +* tests/lang/bug30085.phpt + tests/lang/bug30085.phpt: + + file bug30085.phpt was initially added on branch PHP_5_0. + 2004-10-03 Rob Richards [EMAIL PROTECTED] * ext/dom/dom_fe.h @@ -10620,7 +10688,7 @@ 2004-03-18 Pierre-Alain Joye [EMAIL PROTECTED] * ext/gd/tests/bug27582_2.phpt: - - Fix the test description and $Id: ChangeLog,v 1.1765 2004/10/04 00:34:36 changelog Exp $ + - Fix the test description and $Id: ChangeLog,v 1.1766 2004/10/05 00:35:04 changelog Exp $ 2004-03-18 Derick Rethans [EMAIL PROTECTED]
[PHP-CVS-DAILY] cvs: ZendEngine2 / ChangeLog
changelog Mon Oct 4 20:35:08 2004 EDT Modified files: /ZendEngine2ChangeLog Log: ChangeLog update http://cvs.php.net/diff.php/ZendEngine2/ChangeLog?r1=1.562r2=1.563ty=u Index: ZendEngine2/ChangeLog diff -u ZendEngine2/ChangeLog:1.562 ZendEngine2/ChangeLog:1.563 --- ZendEngine2/ChangeLog:1.562 Sat Oct 2 20:35:29 2004 +++ ZendEngine2/ChangeLog Mon Oct 4 20:35:08 2004 @@ -1,3 +1,35 @@ +2004-10-04 Andi Gutmans [EMAIL PROTECTED] + +* zend_API.h + zend_execute_API.c: + - Rename delete_global_variable() to zend_delete_global_variable() + +* Zend.m4 + zend_API.h + zend_compile.c + zend_compile.h + zend_execute.c + zend_execute_API.c + zend_language_parser.y + zend_opcode.c + zend_vm.h + zend_vm_handlers.h + zend_vm_spec.h: + - Commit the variable fetch optimization. + - Extensions which delete global variables need to use new special + function + - delete_global_variable() (I'm about to rename it) to remove them. + - Will post to internals@ or via commit messages if there's anything else. + +2004-10-04 Marcus Boerger [EMAIL PROTECTED] + +* zend_builtin_functions.c: + - Bugfix #27798 + +* tests/bug27798.phpt: + + - Add new test + 2004-10-02 Marcus Boerger [EMAIL PROTECTED] * (PHP_5_0) @@ -5909,7 +5941,7 @@ 2003-06-10 Jani Taskinen [EMAIL PROTECTED] * zend_multiply.h: - - Missing $Id: ChangeLog,v 1.562 2004/10/03 00:35:29 changelog Exp $ tag + - Missing $Id: ChangeLog,v 1.563 2004/10/05 00:35:08 changelog Exp $ tag 2003-06-10 James Cox [EMAIL PROTECTED] @@ -7633,7 +7665,7 @@ zend_types.h zend_variables.c zend_variables.h: - - Added some missing CVS $Id: ChangeLog,v 1.562 2004/10/03 00:35:29 changelog Exp $ tags, headers and footers. + - Added some missing CVS $Id: ChangeLog,v 1.563 2004/10/05 00:35:08 changelog Exp $ tags, headers and footers. 2003-01-30 Ilia Alshanetsky [EMAIL PROTECTED]
[PHP-CVS] cvs: php-src /ext/session mod_files.c
hyanantha Mon Oct 4 04:52:57 2004 EDT Modified files: /php-src/ext/sessionmod_files.c Log: modified to 3rd argument of fcntl to FD_CLOEXEC http://cvs.php.net/diff.php/php-src/ext/session/mod_files.c?r1=1.97r2=1.98ty=u Index: php-src/ext/session/mod_files.c diff -u php-src/ext/session/mod_files.c:1.97 php-src/ext/session/mod_files.c:1.98 --- php-src/ext/session/mod_files.c:1.97Thu Sep 30 10:23:51 2004 +++ php-src/ext/session/mod_files.c Mon Oct 4 04:52:53 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mod_files.c,v 1.97 2004/09/30 14:23:51 hyanantha Exp $ */ +/* $Id: mod_files.c,v 1.98 2004/10/04 08:52:53 hyanantha Exp $ */ #include php.h @@ -166,12 +166,7 @@ flock(data-fd, LOCK_EX); #ifdef F_SETFD -#ifdef NETWARE - /* NetWare LibC returns -1 upon error and upon success it returns non-zero unlike zero in other OSes*/ - if (fcntl(data-fd, F_SETFD, 1) == -1) { -#else - if (fcntl(data-fd, F_SETFD, 1)) { -#endif + if (fcntl(data-fd, F_SETFD, FD_CLOEXEC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, fcntl(%d, F_SETFD, 1) failed: %s (%d), data-fd, strerror(errno), errno); } #endif -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/session mod_files.c
Don't forgot to update the error message. - Sascha On Mon, 4 Oct 2004, Anantha Kesari H Y wrote: hyanantha Mon Oct 4 04:52:57 2004 EDT Modified files: /php-src/ext/session mod_files.c Log: modified to 3rd argument of fcntl to FD_CLOEXEC http://cvs.php.net/diff.php/php-src/ext/session/mod_files.c?r1=1.97r2=1.98ty=u Index: php-src/ext/session/mod_files.c diff -u php-src/ext/session/mod_files.c:1.97 php-src/ext/session/mod_files.c:1.98 --- php-src/ext/session/mod_files.c:1.97Thu Sep 30 10:23:51 2004 +++ php-src/ext/session/mod_files.c Mon Oct 4 04:52:53 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mod_files.c,v 1.97 2004/09/30 14:23:51 hyanantha Exp $ */ +/* $Id: mod_files.c,v 1.98 2004/10/04 08:52:53 hyanantha Exp $ */ #include php.h @@ -166,12 +166,7 @@ flock(data-fd, LOCK_EX); #ifdef F_SETFD -#ifdef NETWARE - /* NetWare LibC returns -1 upon error and upon success it returns non-zero unlike zero in other OSes*/ - if (fcntl(data-fd, F_SETFD, 1) == -1) { -#else - if (fcntl(data-fd, F_SETFD, 1)) { -#endif + if (fcntl(data-fd, F_SETFD, FD_CLOEXEC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, fcntl(%d, F_SETFD, 1) failed: %s (%d), data-fd, strerror(errno), errno); } #endif -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_0) / NEWS
helly Mon Oct 4 05:04:04 2004 EDT Modified files: (Branch: PHP_5_0) /php-srcNEWS Log: BFN http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1760.2.88r2=1.1760.2.89ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1760.2.88 php-src/NEWS:1.1760.2.89 --- php-src/NEWS:1.1760.2.88Thu Sep 30 11:00:57 2004 +++ php-src/NEWSMon Oct 4 05:04:00 2004 @@ -9,6 +9,8 @@ - Fixed bug #30147 (OO sqlite_fetch_object did not reset error handler). (Wez) - Fixed bug #30133 (get_current_user() crashes on Windows). (Edin) - Fixed bug #30057 (did not detect IPV6 on FreeBSD 4.1). (Wez) +- Fixed bug #27798 (private / protected variables not exposed by + get_object_vars() inside class). (Marcus) 23 Sep 2004, PHP 5.0.2 - Added new boolean (fourth) parameter to array_slice() that turns on the -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /tests/classes static_this.phpt
helly Mon Oct 4 13:30:54 2004 EDT Added files: /php-src/tests/classes static_this.phpt Log: - Add new test http://cvs.php.net/co.php/php-src/tests/classes/static_this.phpt?r=1.1p=1 Index: php-src/tests/classes/static_this.phpt +++ php-src/tests/classes/static_this.phpt --TEST-- $this can be an argument to a static function --FILE-- ?php class TestClass { function __construct() { self::Test1(); $this-Test1(); } static function Test1() { var_dump($this); } static function Test2($this) { var_dump($this); } } $obj = new TestClass; TestClass::Test2(new stdClass); ? ===DONE=== --EXPECTF-- Notice: Undefined variable: this in %sstatic_this.php on line %d NULL Notice: Undefined variable: this in %sstatic_this.php on line %d NULL object(stdClass)#%d (0) { } ===DONE=== -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_0) /tests/classes static_this.phpt
helly Mon Oct 4 13:31:38 2004 EDT Added files: (Branch: PHP_5_0) /php-src/tests/classes static_this.phpt Log: - MFH Add new test http://cvs.php.net/co.php/php-src/tests/classes/static_this.phpt?r=1.1p=1 Index: php-src/tests/classes/static_this.phpt +++ php-src/tests/classes/static_this.phpt --TEST-- $this can be an argument to a static function --FILE-- ?php class TestClass { function __construct() { self::Test1(); $this-Test1(); } static function Test1() { var_dump($this); } static function Test2($this) { var_dump($this); } } $obj = new TestClass; TestClass::Test2(new stdClass); ? ===DONE=== --EXPECTF-- Notice: Undefined variable: this in %sstatic_this.php on line %d NULL Notice: Undefined variable: this in %sstatic_this.php on line %d NULL object(stdClass)#%d (0) { } ===DONE=== -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard/tests/array bug29992.phpt
helly Mon Oct 4 13:53:55 2004 EDT Added files: /php-src/ext/standard/tests/array bug29992.phpt Log: - Add new test http://cvs.php.net/co.php/php-src/ext/standard/tests/array/bug29992.phpt?r=1.1p=1 Index: php-src/ext/standard/tests/array/bug29992.phpt +++ php-src/ext/standard/tests/array/bug29992.phpt --TEST-- Bug #29992 (foreach by reference corrupts the array) --FILE-- ?php $array = array(1,2,3); print_r($array); foreach($array as $item) var_dump($item); foreach($array as $item) var_dump($item); foreach($array as $item) var_dump($item); foreach($array as $item) var_dump($item); print_r($array); ? ===DONE=== --EXPECT-- Array ( [0] = 1 [1] = 2 [2] = 3 ) int(1) int(2) int(3) int(1) int(2) int(3) int(1) int(2) int(3) int(1) int(2) int(3) Array ( [0] = 1 [1] = 2 [2] = 3 ) ===DONE=== -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_0) /ext/standard/tests/array bug29992.phpt
helly Mon Oct 4 13:54:14 2004 EDT Added files: (Branch: PHP_5_0) /php-src/ext/standard/tests/array bug29992.phpt Log: MFH http://cvs.php.net/co.php/php-src/ext/standard/tests/array/bug29992.phpt?r=1.1p=1 Index: php-src/ext/standard/tests/array/bug29992.phpt +++ php-src/ext/standard/tests/array/bug29992.phpt --TEST-- Bug #29992 (foreach by reference corrupts the array) --FILE-- ?php $array = array(1,2,3); print_r($array); foreach($array as $item) var_dump($item); foreach($array as $item) var_dump($item); foreach($array as $item) var_dump($item); foreach($array as $item) var_dump($item); print_r($array); ? ===DONE=== --EXPECT-- Array ( [0] = 1 [1] = 2 [2] = 3 ) int(1) int(2) int(3) int(1) int(2) int(3) int(1) int(2) int(3) int(1) int(2) int(3) Array ( [0] = 1 [1] = 2 [2] = 3 ) ===DONE=== -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/session session.c /ext/spl spl_array.c /ext/standard array.c basic_functions.c ZendEngine2 zend_API.h zend_execute_API.c
andiMon Oct 4 16:17:07 2004 EDT Modified files: /ZendEngine2zend_API.h zend_execute_API.c /php-src/ext/sessionsession.c /php-src/ext/splspl_array.c /php-src/ext/standard array.c basic_functions.c Log: - Rename delete_global_variable() to zend_delete_global_variable() http://cvs.php.net/diff.php/ZendEngine2/zend_API.h?r1=1.191r2=1.192ty=u Index: ZendEngine2/zend_API.h diff -u ZendEngine2/zend_API.h:1.191 ZendEngine2/zend_API.h:1.192 --- ZendEngine2/zend_API.h:1.191Mon Oct 4 15:54:34 2004 +++ ZendEngine2/zend_API.h Mon Oct 4 16:17:04 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: zend_API.h,v 1.191 2004/10/04 19:54:34 andi Exp $ */ +/* $Id: zend_API.h,v 1.192 2004/10/04 20:17:04 andi Exp $ */ #ifndef ZEND_API_H #define ZEND_API_H @@ -333,7 +333,7 @@ ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length, zend_bool is_ref, int num_symbol_tables, ...); -ZEND_API int delete_global_variable(char *name, int name_len TSRMLS_DC); +ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC); #define add_method(arg, key, method) add_assoc_function((arg), (key), (method)) http://cvs.php.net/diff.php/ZendEngine2/zend_execute_API.c?r1=1.302r2=1.303ty=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.302 ZendEngine2/zend_execute_API.c:1.303 --- ZendEngine2/zend_execute_API.c:1.302Mon Oct 4 15:54:34 2004 +++ ZendEngine2/zend_execute_API.c Mon Oct 4 16:17:04 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend_execute_API.c,v 1.302 2004/10/04 19:54:34 andi Exp $ */ +/* $Id: zend_execute_API.c,v 1.303 2004/10/04 20:17:04 andi Exp $ */ #include stdio.h #include signal.h @@ -1343,7 +1343,7 @@ } } -ZEND_API int delete_global_variable(char *name, int name_len TSRMLS_DC) +ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC) { zend_execute_data *ex; http://cvs.php.net/diff.php/php-src/ext/session/session.c?r1=1.399r2=1.400ty=u Index: php-src/ext/session/session.c diff -u php-src/ext/session/session.c:1.399 php-src/ext/session/session.c:1.400 --- php-src/ext/session/session.c:1.399 Mon Oct 4 15:54:35 2004 +++ php-src/ext/session/session.c Mon Oct 4 16:17:06 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: session.c,v 1.399 2004/10/04 19:54:35 andi Exp $ */ +/* $Id: session.c,v 1.400 2004/10/04 20:17:06 andi Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -526,8 +526,8 @@ zval *session_vars = NULL; /* Unconditionally destroy existing arrays -- possible dirty data */ - delete_global_variable(HTTP_SESSION_VARS, sizeof(HTTP_SESSION_VARS)-1 TSRMLS_CC); - delete_global_variable(_SESSION, sizeof(_SESSION)-1 TSRMLS_CC); + zend_delete_global_variable(HTTP_SESSION_VARS, sizeof(HTTP_SESSION_VARS)-1 TSRMLS_CC); + zend_delete_global_variable(_SESSION, sizeof(_SESSION)-1 TSRMLS_CC); MAKE_STD_ZVAL(session_vars); array_init(session_vars); @@ -1679,7 +1679,7 @@ while (zend_hash_get_current_key_ex(ht, str, str_len, num_key, 0, pos) == HASH_KEY_IS_STRING) { - delete_global_variable(str, str_len-1 TSRMLS_CC); + zend_delete_global_variable(str, str_len-1 TSRMLS_CC); zend_hash_move_forward_ex(ht, pos); } } http://cvs.php.net/diff.php/php-src/ext/spl/spl_array.c?r1=1.51r2=1.52ty=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.51 php-src/ext/spl/spl_array.c:1.52 --- php-src/ext/spl/spl_array.c:1.51Mon Oct 4 15:54:35 2004 +++ php-src/ext/spl/spl_array.c Mon Oct 4 16:17:06 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.51 2004/10/04 19:54:35 andi Exp $ */ +/* $Id: spl_array.c,v 1.52 2004/10/04 20:17:06 andi Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -279,7 +279,7 @@ switch(Z_TYPE_P(offset)) { case IS_STRING: if (HASH_OF(intern-array) == EG(symbol_table)) { - if (delete_global_variable(Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC)) { + if (zend_delete_global_variable(Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC)) { zend_error(E_NOTICE,Undefined index: %s, Z_STRVAL_P(offset)); } } else { http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.276r2=1.277ty=u Index: php-src/ext/standard/array.c diff -u
[PHP-CVS] cvs: php-src /ext/standard image.c
iliaa Mon Oct 4 16:42:30 2004 EDT Modified files: /php-src/ext/standard image.c Log: Fixed bug #30281 (Prevent non-wbmp images from being detected as such). http://cvs.php.net/diff.php/php-src/ext/standard/image.c?r1=1.101r2=1.102ty=u Index: php-src/ext/standard/image.c diff -u php-src/ext/standard/image.c:1.101 php-src/ext/standard/image.c:1.102 --- php-src/ext/standard/image.c:1.101 Sat Sep 25 10:46:24 2004 +++ php-src/ext/standard/image.cMon Oct 4 16:42:30 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: image.c,v 1.101 2004/09/25 14:46:24 hyanantha Exp $ */ +/* $Id: image.c,v 1.102 2004/10/04 20:42:30 iliaa Exp $ */ #include php.h #include stdio.h @@ -954,7 +954,7 @@ } while (i 0x80); /* maximum valid sizes for wbmp (although 127x127 may be a more accurate one) */ - if (height 2048 || width 2048) { + if (!height || !width || height 2048 || width 2048) { return 0; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_4_3) / NEWS /ext/standard image.c
iliaa Mon Oct 4 16:44:08 2004 EDT Modified files: (Branch: PHP_4_3) /php-srcNEWS /php-src/ext/standard image.c Log: MFH: Fixed bug #30281 (Prevent non-wbmp images from being detected as such) http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.737r2=1.1247.2.738ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.737 php-src/NEWS:1.1247.2.738 --- php-src/NEWS:1.1247.2.737 Thu Sep 30 11:02:06 2004 +++ php-src/NEWSMon Oct 4 16:44:07 2004 @@ -3,8 +3,10 @@ ?? ??? 2004, Version 4.3.10 - Backported Marcus' foreach() speedup patch from PHP 5.x. (Derick) - Fixed potential problems with unserializing invalid serialize data. (Marcus) -- Fixed bug #30282 (segfault when using unknown/unsupported session.save_handler - and/or session.serialize_handler). (Tony) +- Fixed bug #30282 (segfault when using unknown/unsupported + session.save_handler and/or session.serialize_handler). (Tony) +- Fixed bug #30281 (Prevent non-wbmp images from being detected as such). + (Ilia) - Fixed bug #30276 (Possible crash in ctype_digit on large numbers). (Ilia) - Fixed bug #30224 (Sybase date strings are sometimes not null terminated). (Ilia) http://cvs.php.net/diff.php/php-src/ext/standard/image.c?r1=1.72.2.14r2=1.72.2.15ty=u Index: php-src/ext/standard/image.c diff -u php-src/ext/standard/image.c:1.72.2.14 php-src/ext/standard/image.c:1.72.2.15 --- php-src/ext/standard/image.c:1.72.2.14 Thu Jul 29 21:10:46 2004 +++ php-src/ext/standard/image.cMon Oct 4 16:44:07 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: image.c,v 1.72.2.14 2004/07/30 01:10:46 iliaa Exp $ */ +/* $Id: image.c,v 1.72.2.15 2004/10/04 20:44:07 iliaa Exp $ */ #include php.h #include stdio.h @@ -942,7 +942,7 @@ } while (i 0x80); /* maximum valid sizes for wbmp (although 127x127 may be a more accurate one) */ - if (height 2048 || width 2048) { + if (!height || !width || height 2048 || width 2048) { return 0; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main SAPI.c main.c TSRM tsrm_virtual_cwd.c tsrm_virtual_cwd.h
andiMon Oct 4 20:42:25 2004 EDT Modified files: /TSRM tsrm_virtual_cwd.c tsrm_virtual_cwd.h /php-src/main SAPI.c main.c Log: - Apply realpath() cache patch. We don't use it if we're in safe_mode and - friends (which are quite slow anyway). - If it proves to be stable I'll remove the #ifdef's in a few weeks. http://cvs.php.net/diff.php/TSRM/tsrm_virtual_cwd.c?r1=1.62r2=1.63ty=u Index: TSRM/tsrm_virtual_cwd.c diff -u TSRM/tsrm_virtual_cwd.c:1.62 TSRM/tsrm_virtual_cwd.c:1.63 --- TSRM/tsrm_virtual_cwd.c:1.62Tue Mar 9 09:56:34 2004 +++ TSRM/tsrm_virtual_cwd.c Mon Oct 4 20:42:25 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: tsrm_virtual_cwd.c,v 1.62 2004/03/09 14:56:34 iliaa Exp $ */ +/* $Id: tsrm_virtual_cwd.c,v 1.63 2004/10/05 00:42:25 andi Exp $ */ #include sys/types.h #include sys/stat.h @@ -60,9 +60,9 @@ #endif #ifdef ZTS -static ts_rsrc_id cwd_globals_id; +ts_rsrc_id cwd_globals_id; #else -static virtual_cwd_globals cwd_globals; +virtual_cwd_globals cwd_globals; #endif cwd_state main_cwd_state; /* True global */ @@ -175,11 +175,31 @@ static void cwd_globals_ctor(virtual_cwd_globals *cwd_globals TSRMLS_DC) { CWD_STATE_COPY(cwd_globals-cwd, main_cwd_state); +#ifdef REALPATH_CACHE + cwd_globals-realpath_cache_size = 0; + cwd_globals-realpath_cache_size_limit = REALPATH_CACHE_SIZE; + cwd_globals-realpath_cache_ttl = REALPATH_CACHE_TTL; + memset(cwd_globals-realpath_cache, 0, sizeof(cwd_globals-realpath_cache)); +#endif } static void cwd_globals_dtor(virtual_cwd_globals *cwd_globals TSRMLS_DC) { CWD_STATE_FREE(cwd_globals-cwd); +#ifdef REALPATH_CACHE + { + int i; + + for (i = 0; i sizeof(cwd_globals-realpath_cache)/sizeof(cwd_globals-realpath_cache[0]); i++) { + realpath_cache_bucket *p = cwd_globals-realpath_cache[i]; + while (p != NULL) { + realpath_cache_bucket *r = p; + p = p-next; + free(r); + } + } + } +#endif } static char *tsrm_strndup(const char *s, size_t length) @@ -287,6 +307,65 @@ return buf; } +#ifdef REALPATH_CACHE +static inline unsigned long realpath_cache_key(const char *path, int path_len) +{ + register unsigned long h; + + const char *e = path + path_len; + for (h = 2166136261U; path e; ) { +h *= 16777619; +h ^= *path++; + } + return h; +} + +static inline void realpath_cache_add(const char *path, int path_len, const char *realpath, int realpath_len, time_t t TSRMLS_DC) +{ + long size = sizeof(realpath_cache_bucket) + path_len + 1 + realpath_len + 1; + if (CWDG(realpath_cache_size) + size = CWDG(realpath_cache_size_limit)) { + realpath_cache_bucket *bucket = malloc(size); + unsigned long n; + + bucket-key = realpath_cache_key(path, path_len); + bucket-path = (char*)bucket + sizeof(realpath_cache_bucket); + memcpy(bucket-path, path, path_len+1); + bucket-path_len = path_len; + bucket-realpath = bucket-path + (path_len + 1); + memcpy(bucket-realpath, realpath, realpath_len+1); + bucket-realpath_len = realpath_len; + bucket-expires = t + CWDG(realpath_cache_ttl); + n = bucket-key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); + bucket-next = CWDG(realpath_cache)[n]; + CWDG(realpath_cache)[n] = bucket; + CWDG(realpath_cache_size) += size; + } +} + +static inline realpath_cache_bucket* realpath_cache_find(const char *path, int path_len, time_t t TSRMLS_DC) +{ + unsigned long key = realpath_cache_key(path, path_len); + unsigned long n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); + realpath_cache_bucket **bucket = CWDG(realpath_cache)[n]; + + while (*bucket != NULL) { + if (CWDG(realpath_cache_ttl) (*bucket)-expires t) { + realpath_cache_bucket *r = *bucket; + *bucket = (*bucket)-next; + CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r-path_len + 1 + r-realpath_len + 1; + free(r); + } else if (key == (*bucket)-key path_len == (*bucket)-path_len + memcmp(path, (*bucket)-path, path_len) == 0) { + return *bucket; + } else { + *bucket = (*bucket)-next; + } + } + return NULL; +} +#endif + + /* Resolve path relatively to state and put the real path into state */ /* returns 0 for ok, 1 for error */ CWD_API int virtual_file_ex(cwd_state *state, const