[PHP-CVS] com php-src: Add SplDoublyLinkedList::add to UPGRADING: UPGRADING
Commit:6af1b08482f2b3a3fdb58693d37e1ed51007b83c Author:Etienne Kneuss col...@php.net Fri, 22 Mar 2013 11:35:45 +0100 Parents: fd2b8df26562331fe1eccdc10efb3d8f98379a68 Branches: PHP-5.5 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6af1b08482f2b3a3fdb58693d37e1ed51007b83c Log: Add SplDoublyLinkedList::add to UPGRADING Changed paths: M UPGRADING Diff: diff --git a/UPGRADING b/UPGRADING index cc3aebb..19a08e4 100755 --- a/UPGRADING +++ b/UPGRADING @@ -277,6 +277,7 @@ PHP 5.5 UPGRADE NOTES - SPL: - SplFixedArray::__wakeup() + - SplDoublyLinkedList::add() - Zend OPcache - opcache_get_configuration() -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Remove spurious int cast in between two longs: ext/spl/spl_dllist.c
Commit:62364e6e01092911fa11e6d28f9acc3ed9af07e8 Author:Etienne Kneuss col...@php.net Sat, 16 Mar 2013 18:19:14 +0100 Parents: b903d2d6cdf9a9efac181a21e95ea93dc8a864dd Branches: PHP-5.3 PHP-5.4 PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=62364e6e01092911fa11e6d28f9acc3ed9af07e8 Log: Remove spurious int cast in between two longs Changed paths: M ext/spl/spl_dllist.c Diff: diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 964ad99..38e6aac 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -875,7 +875,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetUnset) } intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - index = (int)spl_offset_convert_to_long(zindex TSRMLS_CC); + index = spl_offset_convert_to_long(zindex TSRMLS_CC); llist = intern-llist; if (index 0 || index = intern-llist-count) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Merge branch 'PHP-5.3' into PHP-5.4: ext/spl/spl_dllist.c
Commit:5de1b08482cdf2385e263f68ce9ea4001f724ffd Author:Etienne Kneuss col...@php.net Sat, 16 Mar 2013 18:20:06 +0100 Parents: 73c38eca5a7f3c68e1122aee001409dbd615c5a8 62364e6e01092911fa11e6d28f9acc3ed9af07e8 Branches: PHP-5.4 PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5de1b08482cdf2385e263f68ce9ea4001f724ffd Log: Merge branch 'PHP-5.3' into PHP-5.4 * PHP-5.3: Remove spurious int cast in between two longs Changed paths: MM ext/spl/spl_dllist.c Diff: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/spl/spl_dllist.c
Commit:b46897941ac094e4e2fc09a5f1d4eeb7f8efca59 Author:Etienne Kneuss col...@php.net Sat, 16 Mar 2013 18:20:16 +0100 Parents: c1cf7538f07d8f905afbff5e82f4c727f6cb9fee 5de1b08482cdf2385e263f68ce9ea4001f724ffd Branches: PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b46897941ac094e4e2fc09a5f1d4eeb7f8efca59 Log: Merge branch 'PHP-5.4' into PHP-5.5 * PHP-5.4: Remove spurious int cast in between two longs Changed paths: MM ext/spl/spl_dllist.c Diff: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fix bug #61681: Malformed grammar: NEWS Zend/tests/bug61681.phpt Zend/zend_language_scanner.c Zend/zend_language_scanner.l Zend/zend_language_scanner_defs.h
Commit:b233de098daceb145b9a5009b8861ebb9df5c961 Author:Nikita Popov ni...@php.net Mon, 9 Apr 2012 18:19:49 +0200 Parents: 8ac56c15c98f27ac097fe53ac3bdf91a543eaed2 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b233de098daceb145b9a5009b8861ebb9df5c961 Log: Fix bug #61681: Malformed grammar Generate T_STRING_VARNAME only if it actually is one. This is only the case for ${varname} and ${varname[offset]} so we can just add a check for } or [ after the LABEL. Bugs: https://bugs.php.net/61681 Changed paths: M NEWS A Zend/tests/bug61681.phpt M Zend/zend_language_scanner.c M Zend/zend_language_scanner.l M Zend/zend_language_scanner_defs.h diff --git a/NEWS b/NEWS index 089d080..6aa804c 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ PHP NEWS - Core: . Implemented FR #60738 (Allow 'set_error_handler' to handle NULL). (Laruence, Nikita Popov) + . Fixed bug #61681 (Malformed grammar). (Nikita Popov, Etienne, Laruence). - cURL: . Added support for CURLOPT_FTP_RESPONSE_TIMEOUT, CURLOPT_APPEND, diff --git a/Zend/tests/bug61681.phpt b/Zend/tests/bug61681.phpt new file mode 100644 index 000..acc0275 --- /dev/null +++ b/Zend/tests/bug61681.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #61681: Malformed grammar +--FILE-- +?php +$la = ooxx; + +echo ${substr('laruence', 0, 2)}; + +? +--EXPECT-- +ooxx diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index 3f6189e..960222a 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Thu Mar 1 21:27:30 2012 */ +/* Generated by re2c 0.13.5 on Mon Apr 9 18:25:45 2012 */ #line 1 Zend/zend_language_scanner.l /* +--+ @@ -1090,7 +1090,7 @@ yyc_INITIAL: yy3: YYDEBUG(3, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1783 Zend/zend_language_scanner.l +#line 1784 Zend/zend_language_scanner.l { if (YYCURSOR YYLIMIT) { return 0; @@ -1168,7 +1168,7 @@ yy5: yy6: YYDEBUG(6, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1771 Zend/zend_language_scanner.l +#line 1772 Zend/zend_language_scanner.l { if (CG(short_tags)) { zendlval-value.str.val = yytext; /* no copying - intentional */ @@ -1187,7 +1187,7 @@ yy7: if ((yych = *YYCURSOR) == '=') goto yy43; YYDEBUG(8, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1748 Zend/zend_language_scanner.l +#line 1749 Zend/zend_language_scanner.l { if (CG(asp_tags)) { zendlval-value.str.val = yytext; /* no copying - intentional */ @@ -1385,7 +1385,7 @@ yy35: ++YYCURSOR; YYDEBUG(38, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1708 Zend/zend_language_scanner.l +#line 1709 Zend/zend_language_scanner.l { YYCTYPE *bracket = (YYCTYPE*)zend_memrchr(yytext, '', yyleng - (sizeof(script language=php) - 1)); @@ -1429,7 +1429,7 @@ yy43: ++YYCURSOR; YYDEBUG(44, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1726 Zend/zend_language_scanner.l +#line 1727 Zend/zend_language_scanner.l { if (CG(asp_tags)) { zendlval-value.str.val = yytext; /* no copying - intentional */ @@ -1447,7 +1447,7 @@ yy45: ++YYCURSOR; YYDEBUG(46, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1739 Zend/zend_language_scanner.l +#line 1740 Zend/zend_language_scanner.l { zendlval-value.str.val = yytext; /* no copying - intentional */ zendlval-value.str.len = yyleng; @@ -1482,7 +1482,7 @@ yy50: yy51: YYDEBUG(51, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 1761 Zend/zend_language_scanner.l +#line 1762 Zend/zend_language_scanner.l { zendlval-value.str.val = yytext; /* no copying - intentional */ zendlval-value.str.len = yyleng; @@ -1562,7 +1562,7 @@ yyc_ST_BACKQUOTE: yy56: YYDEBUG(56, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2234 Zend/zend_language_scanner.l +#line 2235 Zend/zend_language_scanner.l { if (YYCURSOR YYLIMIT) { return 0; @@ -1614,7 +1614,7 @@ yy58: ++YYCURSOR; YYDEBUG(59, *YYCURSOR); yyleng = YYCURSOR - SCNG(yy_text); -#line 2178 Zend/zend_language_scanner.l +#line 2179 Zend/zend_language_scanner.l { BEGIN(ST_IN_SCRIPTING); return '`'; @@ -1629,7 +1629,7 @@ yy61: ++YYCURSOR; YYDEBUG(62, *YYCURSOR);
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/spl/tests/ bug60082.phpt
colder Wed, 01 Feb 2012 13:25:32 + Revision: http://svn.php.net/viewvc?view=revisionrevision=322994 Log: Fix test Changed paths: U php/php-src/branches/PHP_5_3/ext/spl/tests/bug60082.phpt Modified: php/php-src/branches/PHP_5_3/ext/spl/tests/bug60082.phpt === --- php/php-src/branches/PHP_5_3/ext/spl/tests/bug60082.phpt2012-02-01 12:16:52 UTC (rev 322993) +++ php/php-src/branches/PHP_5_3/ext/spl/tests/bug60082.phpt2012-02-01 13:25:32 UTC (rev 322994) @@ -16,6 +16,4 @@ ===DONE=== ?php exit(0); ? --EXPECTF-- -Deprecated: Call-time pass-by-reference has been deprecated in %sbug60082.php on line %d - -Fatal error: main(): Array was modified outside object and made a recursive object in %sbug60082.php on line %d +Fatal error: main(): Nesting level too deep - recursive dependency? in %sbug60082.php on line %d -- 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_4/Zend/zend_object_handlers.c trunk/Zend/zend_object_handlers.c
colder Thu, 15 Sep 2011 14:50:38 + Revision: http://svn.php.net/viewvc?view=revisionrevision=316816 Log: Fix folding Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_object_handlers.c U php/php-src/trunk/Zend/zend_object_handlers.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_object_handlers.c === --- php/php-src/branches/PHP_5_4/Zend/zend_object_handlers.c2011-09-15 11:47:42 UTC (rev 316815) +++ php/php-src/branches/PHP_5_4/Zend/zend_object_handlers.c2011-09-15 14:50:38 UTC (rev 316816) @@ -89,8 +89,8 @@ } } } +/* }}} */ - ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC) /* {{{ */ { zend_object *zobj; Modified: php/php-src/trunk/Zend/zend_object_handlers.c === --- php/php-src/trunk/Zend/zend_object_handlers.c 2011-09-15 11:47:42 UTC (rev 316815) +++ php/php-src/trunk/Zend/zend_object_handlers.c 2011-09-15 14:50:38 UTC (rev 316816) @@ -89,8 +89,8 @@ } } } +/* }}} */ - ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC) /* {{{ */ { zend_object *zobj; -- 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_4/ext/spl/spl_directory.c branches/PHP_5_4/ext/spl/tests/SplFileObject_fflush_basic_001.phpt branches/PHP_5_4/ext/spl/tests/SplFileObject_ftruncate_error_00
colder Thu, 08 Sep 2011 15:52:59 + Revision: http://svn.php.net/viewvc?view=revisionrevision=316420 Log: SplFileObject does not accept directories. It did not check for that and blindly opened the directory, which works on linux but fails on windows. Now SplFileObject uses a stat() call to make sure it isn't a directory, if it is, it fails with an exception. Tests have been changed accordingly. Changed paths: U php/php-src/branches/PHP_5_4/ext/spl/spl_directory.c U php/php-src/branches/PHP_5_4/ext/spl/tests/SplFileObject_fflush_basic_001.phpt U php/php-src/branches/PHP_5_4/ext/spl/tests/SplFileObject_ftruncate_error_001.phpt U php/php-src/branches/PHP_5_4/ext/spl/tests/fileobject_003.phpt U php/php-src/trunk/ext/spl/spl_directory.c U php/php-src/trunk/ext/spl/tests/SplFileObject_fflush_basic_001.phpt U php/php-src/trunk/ext/spl/tests/SplFileObject_ftruncate_error_001.phpt U php/php-src/trunk/ext/spl/tests/fileobject_003.phpt Modified: php/php-src/branches/PHP_5_4/ext/spl/spl_directory.c === --- php/php-src/branches/PHP_5_4/ext/spl/spl_directory.c 2011-09-08 15:20:17 UTC (rev 316419) +++ php/php-src/branches/PHP_5_4/ext/spl/spl_directory.c 2011-09-08 15:52:59 UTC (rev 316420) @@ -,6 +,7 @@ char *p1, *p2; char *tmp_path; int tmp_path_len; + zval tmp; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, error_handling TSRMLS_CC); @@ -2243,6 +2244,16 @@ intern-u.file.open_mode = r; intern-u.file.open_mode_len = 1; } + + php_stat(intern-file_name, intern-file_name_len, FS_IS_DIR, tmp TSRMLS_CC); + + if (Z_LVAL(tmp)) { + zend_restore_error_handling(error_handling TSRMLS_CC); + intern-u.file.open_mode = NULL; + intern-file_name = NULL; + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, Cannot use SplFileObject with directories); + return; + } if (spl_filesystem_file_open(intern, use_include_path, 0 TSRMLS_CC) == SUCCESS) { tmp_path_len = strlen(intern-u.file.stream-orig_path); Modified: php/php-src/branches/PHP_5_4/ext/spl/tests/SplFileObject_fflush_basic_001.phpt === --- php/php-src/branches/PHP_5_4/ext/spl/tests/SplFileObject_fflush_basic_001.phpt 2011-09-08 15:20:17 UTC (rev 316419) +++ php/php-src/branches/PHP_5_4/ext/spl/tests/SplFileObject_fflush_basic_001.phpt 2011-09-08 15:52:59 UTC (rev 316420) @@ -17,9 +17,12 @@ var $varname; function stream_open($path, $mode, $options, $opened_path) -{ +{ return true; } + +function url_stat() { +} } stream_wrapper_register(SPLtest, VariableStream); $ftruncate_test = ; Modified: php/php-src/branches/PHP_5_4/ext/spl/tests/SplFileObject_ftruncate_error_001.phpt === --- php/php-src/branches/PHP_5_4/ext/spl/tests/SplFileObject_ftruncate_error_001.phpt 2011-09-08 15:20:17 UTC (rev 316419) +++ php/php-src/branches/PHP_5_4/ext/spl/tests/SplFileObject_ftruncate_error_001.phpt 2011-09-08 15:52:59 UTC (rev 316420) @@ -12,6 +12,9 @@ { return true; } + +function url_stat() { +} } stream_wrapper_register(SPLtest, VariableStream); $ftruncate_test = ; Modified: php/php-src/branches/PHP_5_4/ext/spl/tests/fileobject_003.phpt === --- php/php-src/branches/PHP_5_4/ext/spl/tests/fileobject_003.phpt 2011-09-08 15:20:17 UTC (rev 316419) +++ php/php-src/branches/PHP_5_4/ext/spl/tests/fileobject_003.phpt 2011-09-08 15:52:59 UTC (rev 316420) @@ -18,18 +18,21 @@ var_dump($o == $c); var_dump($o-getPathname() == $c-getPathname()); - $f = new SplFileObject($name); - var_dump($name); - var_dump($f-getPathName()); - $l = substr($f-getPathName(), -1); - var_dump($l != '/' $l != '\\' $l == $lc); - var_dump($f-getFileName()); - $l = substr($f-getFileName(), -1); - var_dump($l != '/' $l != '\\' $l == $lc); - var_dump($f-getPath()); - $l = substr($f-getPath(), -1); - var_dump($l != '/' $l != '\\' $l == $lp); - + try { + $f = new SplFileObject($name); + var_dump($name); + var_dump($f-getPathName()); + $l = substr($f-getPathName(), -1); + var_dump($l != '/' $l != '\\' $l == $lc); + var_dump($f-getFileName()); + $l = substr($f-getFileName(), -1); + var_dump($l != '/' $l != '\\' $l == $lc); + var_dump($f-getPath()); + $l = substr($f-getPath(), -1); + var_dump($l != '/' $l != '\\' $l == $lp); + } catch (LogicException $e) { + echo LogicException: .$e-getMessage().\n; + } $fo = $o-openFile(); var_dump($fo-getPathName(), $fo-getFileName(), $fo-getPath()); } @@ -84,14 +87,8 @@ bool(false) bool(true) bool(true) -%s(%d) %stests/ +LogicException: Cannot use SplFileObject with directories string(%d) %stests -bool(true) -string(5) tests -bool(true) -string(%d)
[PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ext/spl/ spl_directory.c
colder Thu, 08 Sep 2011 23:10:40 + Revision: http://svn.php.net/viewvc?view=revisionrevision=316434 Log: MFH: adapt check for __construct bypass Changed paths: U php/php-src/branches/PHP_5_4/ext/spl/spl_directory.c Modified: php/php-src/branches/PHP_5_4/ext/spl/spl_directory.c === --- php/php-src/branches/PHP_5_4/ext/spl/spl_directory.c2011-09-08 23:07:48 UTC (rev 316433) +++ php/php-src/branches/PHP_5_4/ext/spl/spl_directory.c2011-09-08 23:10:40 UTC (rev 316434) @@ -644,6 +644,7 @@ * constructor or cleared its exception */ return (fsobj-u.dir.entry.d_name[0] != '\0' /* GlobIterator */ || + fsobj-_path != NULL /* SplFileInfo */ || fsobj-orig_path != NULL /* Spl[Temp]FileObject */); } /* }}} */ -- 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_4/ NEWS
colder Thu, 08 Sep 2011 23:18:49 + Revision: http://svn.php.net/viewvc?view=revisionrevision=316436 Log: Mention recent SPL changes on spl_directory.c and tests Changed paths: U php/php-src/branches/PHP_5_4/NEWS Modified: php/php-src/branches/PHP_5_4/NEWS === --- php/php-src/branches/PHP_5_4/NEWS 2011-09-08 23:12:32 UTC (rev 316435) +++ php/php-src/branches/PHP_5_4/NEWS 2011-09-08 23:18:49 UTC (rev 316436) @@ -48,7 +48,11 @@ - Improved Session extension: . Expose session status via new function, session_status (FR #52982) (Arpad) - + +- Improved SPL extension: + . Immediately reject wrong usages of directories under Spl(Temp)FileObject +and friends. (Etienne, Pierre) + - Improved XSL extension: . XSL doesn't stop transformation anymore, if a PHP function can't be called (Christian) -- 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_4/Zend/tests/bug55445.phpt branches/PHP_5_4/Zend/zend_language_scanner.c branches/PHP_5_4/Zend/zend_language_scanner.l branches/PHP_5_4/Zend/zend_language_s
colder Wed, 17 Aug 2011 23:50:04 + Revision: http://svn.php.net/viewvc?view=revisionrevision=315119 Log: Fix bug #55445 (Incomplete implementation of ?= being independant of short_open_tag) Bug: https://bugs.php.net/55445 (Assigned) Short echo tag still depends on short_open_tag setting Changed paths: A php/php-src/branches/PHP_5_4/Zend/tests/bug55445.phpt U php/php-src/branches/PHP_5_4/Zend/zend_language_scanner.c U php/php-src/branches/PHP_5_4/Zend/zend_language_scanner.l U php/php-src/branches/PHP_5_4/Zend/zend_language_scanner_defs.h A php/php-src/trunk/Zend/tests/bug55445.phpt U php/php-src/trunk/Zend/zend_language_scanner.c U php/php-src/trunk/Zend/zend_language_scanner.l U php/php-src/trunk/Zend/zend_language_scanner_defs.h Added: php/php-src/branches/PHP_5_4/Zend/tests/bug55445.phpt === --- php/php-src/branches/PHP_5_4/Zend/tests/bug55445.phpt (rev 0) +++ php/php-src/branches/PHP_5_4/Zend/tests/bug55445.phpt 2011-08-17 23:50:04 UTC (rev 315119) @@ -0,0 +1,8 @@ +--TEST-- +Bug #55445 (Lexer error with short open tags) +--INI-- +short_open_tag=0 +--FILE-- +?php $u = chris; ?pWelcome ?= $u ?/p +--EXPECTF-- +pWelcome chris/p Modified: php/php-src/branches/PHP_5_4/Zend/zend_language_scanner.c === --- php/php-src/branches/PHP_5_4/Zend/zend_language_scanner.c 2011-08-17 23:15:20 UTC (rev 315118) +++ php/php-src/branches/PHP_5_4/Zend/zend_language_scanner.c 2011-08-17 23:50:04 UTC (rev 315119) @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Tue Aug 16 10:45:19 2011 */ +/* Generated by re2c 0.13.5 on Thu Aug 18 01:36:01 2011 */ #line 1 Zend/zend_language_scanner.l /* +--+ @@ -1099,7 +1099,7 @@ if (YYCURSOR YYLIMIT) { switch (*YYCURSOR) { case '?': - if (CG(short_tags) || !strncasecmp(YYCURSOR + 1, php, 3)) { /* Assume [ \t\n\r] follows php */ + if (CG(short_tags) || !strncasecmp(YYCURSOR + 1, php, 3) || (*(YYCURSOR + 1) == '=')) { /* Assume [ \t\n\r] follows php */ break; } continue; Modified: php/php-src/branches/PHP_5_4/Zend/zend_language_scanner.l === --- php/php-src/branches/PHP_5_4/Zend/zend_language_scanner.l 2011-08-17 23:15:20 UTC (rev 315118) +++ php/php-src/branches/PHP_5_4/Zend/zend_language_scanner.l 2011-08-17 23:50:04 UTC (rev 315119) @@ -1780,7 +1780,7 @@ if (YYCURSOR YYLIMIT) { switch (*YYCURSOR) { case '?': - if (CG(short_tags) || !strncasecmp(YYCURSOR + 1, php, 3)) { /* Assume [ \t\n\r] follows php */ + if (CG(short_tags) || !strncasecmp(YYCURSOR + 1, php, 3) || (*(YYCURSOR + 1) == '=')) { /* Assume [ \t\n\r] follows php */ break; } continue; Modified: php/php-src/branches/PHP_5_4/Zend/zend_language_scanner_defs.h === --- php/php-src/branches/PHP_5_4/Zend/zend_language_scanner_defs.h 2011-08-17 23:15:20 UTC (rev 315118) +++ php/php-src/branches/PHP_5_4/Zend/zend_language_scanner_defs.h 2011-08-17 23:50:04 UTC (rev 315119) @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Sun Jul 31 20:09:48 2011 */ +/* Generated by re2c 0.13.5 on Thu Aug 18 01:36:01 2011 */ #line 3 Zend/zend_language_scanner_defs.h enum YYCONDTYPE { Added: php/php-src/trunk/Zend/tests/bug55445.phpt === --- php/php-src/trunk/Zend/tests/bug55445.phpt (rev 0) +++ php/php-src/trunk/Zend/tests/bug55445.phpt 2011-08-17 23:50:04 UTC (rev 315119) @@ -0,0 +1,8 @@ +--TEST-- +Bug #55445 (Lexer error with short open tags) +--INI-- +short_open_tag=0 +--FILE-- +?php $u = chris; ?pWelcome ?= $u ?/p +--EXPECTF-- +pWelcome chris/p Modified: php/php-src/trunk/Zend/zend_language_scanner.c === --- php/php-src/trunk/Zend/zend_language_scanner.c 2011-08-17 23:15:20 UTC (rev 315118) +++ php/php-src/trunk/Zend/zend_language_scanner.c 2011-08-17 23:50:04 UTC (rev 315119) @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Tue Aug 16 12:22:59 2011 */ +/* Generated by re2c 0.13.5 on Thu Aug 18 01:37:48 2011 */ #line 1 Zend/zend_language_scanner.l /*
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/spl/spl_fixedarray.c trunk/ext/spl/spl_fixedarray.c
colder Fri, 12 Aug 2011 21:46:40 + Revision: http://svn.php.net/viewvc?view=revisionrevision=314852 Log: Fix CID 1211, unused intern variable Changed paths: U php/php-src/branches/PHP_5_4/ext/spl/spl_fixedarray.c U php/php-src/trunk/ext/spl/spl_fixedarray.c Modified: php/php-src/branches/PHP_5_4/ext/spl/spl_fixedarray.c === --- php/php-src/branches/PHP_5_4/ext/spl/spl_fixedarray.c 2011-08-12 21:29:41 UTC (rev 314851) +++ php/php-src/branches/PHP_5_4/ext/spl/spl_fixedarray.c 2011-08-12 21:46:40 UTC (rev 314852) @@ -602,7 +602,6 @@ */ SPL_METHOD(SplFixedArray, toArray) { - spl_fixedarray_object *intern; zval *ret, *tmp; HashTable *ret_ht, *obj_ht; @@ -610,8 +609,6 @@ return; } - intern = (spl_fixedarray_object *)zend_object_store_get_object(getThis() TSRMLS_CC); - ALLOC_HASHTABLE(ret_ht); zend_hash_init(ret_ht, 0, NULL, ZVAL_PTR_DTOR, 0); ALLOC_INIT_ZVAL(ret); Modified: php/php-src/trunk/ext/spl/spl_fixedarray.c === --- php/php-src/trunk/ext/spl/spl_fixedarray.c 2011-08-12 21:29:41 UTC (rev 314851) +++ php/php-src/trunk/ext/spl/spl_fixedarray.c 2011-08-12 21:46:40 UTC (rev 314852) @@ -602,7 +602,6 @@ */ SPL_METHOD(SplFixedArray, toArray) { - spl_fixedarray_object *intern; zval *ret, *tmp; HashTable *ret_ht, *obj_ht; @@ -610,8 +609,6 @@ return; } - intern = (spl_fixedarray_object *)zend_object_store_get_object(getThis() TSRMLS_CC); - ALLOC_HASHTABLE(ret_ht); zend_hash_init(ret_ht, 0, NULL, ZVAL_PTR_DTOR, 0); ALLOC_INIT_ZVAL(ret); -- 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_4/ext/spl/ spl_directory.c
colder Fri, 12 Aug 2011 21:57:54 + Revision: http://svn.php.net/viewvc?view=revisionrevision=314853 Log: Fix CID 547, make static analyzer happy Changed paths: U php/php-src/branches/PHP_5_4/ext/spl/spl_directory.c Modified: php/php-src/branches/PHP_5_4/ext/spl/spl_directory.c === --- php/php-src/branches/PHP_5_4/ext/spl/spl_directory.c2011-08-12 21:46:40 UTC (rev 314852) +++ php/php-src/branches/PHP_5_4/ext/spl/spl_directory.c2011-08-12 21:57:54 UTC (rev 314853) @@ -2431,7 +2431,9 @@ { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, intern-flags); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, intern-flags) == FAILURE) { + return; + } } /* }}} */ /* {{{ proto int SplFileObject::getFlags() -- 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_4/ext/spl/spl_array.c trunk/ext/spl/spl_array.c
colder Fri, 12 Aug 2011 22:05:10 + Revision: http://svn.php.net/viewvc?view=revisionrevision=314854 Log: Fix CID 538/539, explicitely check for something that should never occur Changed paths: U php/php-src/branches/PHP_5_4/ext/spl/spl_array.c U php/php-src/trunk/ext/spl/spl_array.c Modified: php/php-src/branches/PHP_5_4/ext/spl/spl_array.c === --- php/php-src/branches/PHP_5_4/ext/spl/spl_array.c2011-08-12 21:57:54 UTC (rev 314853) +++ php/php-src/branches/PHP_5_4/ext/spl/spl_array.c2011-08-12 22:05:10 UTC (rev 314854) @@ -322,8 +322,11 @@ zval *value; ALLOC_INIT_ZVAL(value); zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)value, sizeof(void*), NULL); - zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) retval); - return retval; + if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) retval) != FAILURE) { + return retval; + } else { + return EG(uninitialized_zval_ptr); + } } else { zend_error(E_NOTICE, Undefined index: %s, Z_STRVAL_P(offset)); return EG(uninitialized_zval_ptr); @@ -345,8 +348,11 @@ zval *value; ALLOC_INIT_ZVAL(value); zend_hash_index_update(ht, index, (void**)value, sizeof(void*), NULL); - zend_hash_index_find(ht, index, (void **) retval); - return retval; + if (zend_hash_index_find(ht, index, (void **) retval) != FAILURE) { + return retval; + } else { + return EG(uninitialized_zval_ptr); + } } else { zend_error(E_NOTICE, Undefined offset: %ld, index); return EG(uninitialized_zval_ptr); Modified: php/php-src/trunk/ext/spl/spl_array.c === --- php/php-src/trunk/ext/spl/spl_array.c 2011-08-12 21:57:54 UTC (rev 314853) +++ php/php-src/trunk/ext/spl/spl_array.c 2011-08-12 22:05:10 UTC (rev 314854) @@ -322,8 +322,11 @@ zval *value; ALLOC_INIT_ZVAL(value); zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)value, sizeof(void*), NULL); - zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) retval); - return retval; + if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) retval) != FAILURE) { + return retval; + } else { + return EG(uninitialized_zval_ptr); + } } else { zend_error(E_NOTICE, Undefined index: %s, Z_STRVAL_P(offset)); return EG(uninitialized_zval_ptr); @@ -345,8 +348,11 @@ zval *value; ALLOC_INIT_ZVAL(value); zend_hash_index_update(ht, index, (void**)value, sizeof(void*), NULL); - zend_hash_index_find(ht, index, (void **) retval); - return retval; + if (zend_hash_index_find(ht, index, (void **) retval) != FAILURE) { + return retval; + } else { + return EG(uninitialized_zval_ptr); + } } else { zend_error(E_NOTICE, Undefined offset: %ld, index); return EG(uninitialized_zval_ptr); -- 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_4/ext/spl/spl_iterators.c trunk/ext/spl/spl_iterators.c
colder Fri, 12 Aug 2011 22:20:35 + Revision: http://svn.php.net/viewvc?view=revisionrevision=314855 Log: Fix CID 593 Mark the missing break by an explicit comment, we DO intend to fall through here Changed paths: U php/php-src/branches/PHP_5_4/ext/spl/spl_iterators.c U php/php-src/trunk/ext/spl/spl_iterators.c Modified: php/php-src/branches/PHP_5_4/ext/spl/spl_iterators.c === --- php/php-src/branches/PHP_5_4/ext/spl/spl_iterators.c2011-08-12 22:05:10 UTC (rev 314854) +++ php/php-src/branches/PHP_5_4/ext/spl/spl_iterators.c2011-08-12 22:20:35 UTC (rev 314855) @@ -214,11 +214,12 @@ zend_clear_exception(TSRMLS_C); } } + /* fall through */ case RS_START: if (iterator-funcs-valid(iterator TSRMLS_CC) == FAILURE) { break; } - object-iterators[object-level].state = RS_TEST; + object-iterators[object-level].state = RS_TEST; /* break; */ case RS_TEST: ce = object-iterators[object-level].ce; Modified: php/php-src/trunk/ext/spl/spl_iterators.c === --- php/php-src/trunk/ext/spl/spl_iterators.c 2011-08-12 22:05:10 UTC (rev 314854) +++ php/php-src/trunk/ext/spl/spl_iterators.c 2011-08-12 22:20:35 UTC (rev 314855) @@ -214,6 +214,7 @@ zend_clear_exception(TSRMLS_C); } } + /* fall through */ case RS_START: if (iterator-funcs-valid(iterator TSRMLS_CC) == FAILURE) { break; -- 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/spl/ spl_directory.c
colder Mon, 08 Aug 2011 12:05:34 + Revision: http://svn.php.net/viewvc?view=revisionrevision=314485 Log: Fix validator for SplFileInfo constructor Changed paths: U php/php-src/trunk/ext/spl/spl_directory.c Modified: php/php-src/trunk/ext/spl/spl_directory.c === --- php/php-src/trunk/ext/spl/spl_directory.c 2011-08-08 11:57:18 UTC (rev 314484) +++ php/php-src/trunk/ext/spl/spl_directory.c 2011-08-08 12:05:34 UTC (rev 314485) @@ -633,6 +633,7 @@ * constructor or cleared its exception */ return (fsobj-u.dir.entry.d_name[0] != '\0' /* GlobIterator */ || + fsobj-_path != NULL /* SplFileInfo */ || fsobj-orig_path != NULL /* Spl[Temp]FileObject */); } /* }}} */ @@ -2431,7 +2432,9 @@ { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, intern-flags); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, intern-flags) == FAILURE) { + return; + } } /* }}} */ /* {{{ proto int SplFileObject::getFlags() -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/Zend/ zend_builtin_functions.c
colder Mon, 08 Aug 2011 14:52:34 + Revision: http://svn.php.net/viewvc?view=revisionrevision=314526 Log: Fix typo Changed paths: U php/php-src/trunk/Zend/zend_builtin_functions.c Modified: php/php-src/trunk/Zend/zend_builtin_functions.c === --- php/php-src/trunk/Zend/zend_builtin_functions.c 2011-08-08 14:50:35 UTC (rev 314525) +++ php/php-src/trunk/Zend/zend_builtin_functions.c 2011-08-08 14:52:34 UTC (rev 314526) @@ -1821,7 +1821,7 @@ function_name[0] = '\0'; do { - function_name_length = 1 + snprintf(function_name + 1, sizeof(0lambda_)+MAX_LENGTH_OF_LONG, lambda_%d, ++EG(lambda_count)); + function_name_length = 1 + snprintf(function_name + 1, sizeof(lambda_)+MAX_LENGTH_OF_LONG, lambda_%d, ++EG(lambda_count)); } while (zend_hash_add(EG(function_table), function_name, function_name_length+1, new_function, sizeof(zend_function), NULL)==FAILURE); zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)); RETURN_STRINGL(function_name, function_name_length, 0); -- 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/Zend/zend_builtin_functions.c PHP_5_4/Zend/zend_builtin_functions.c
colder Mon, 08 Aug 2011 14:54:50 + Revision: http://svn.php.net/viewvc?view=revisionrevision=314527 Log: Fix typo Changed paths: U php/php-src/branches/PHP_5_3/Zend/zend_builtin_functions.c U php/php-src/branches/PHP_5_4/Zend/zend_builtin_functions.c Modified: php/php-src/branches/PHP_5_3/Zend/zend_builtin_functions.c === --- php/php-src/branches/PHP_5_3/Zend/zend_builtin_functions.c 2011-08-08 14:52:34 UTC (rev 314526) +++ php/php-src/branches/PHP_5_3/Zend/zend_builtin_functions.c 2011-08-08 14:54:50 UTC (rev 314527) @@ -1713,7 +1713,7 @@ function_name[0] = '\0'; do { - function_name_length = 1 + snprintf(function_name + 1, sizeof(0lambda_)+MAX_LENGTH_OF_LONG, lambda_%d, ++EG(lambda_count)); + function_name_length = 1 + snprintf(function_name + 1, sizeof(lambda_)+MAX_LENGTH_OF_LONG, lambda_%d, ++EG(lambda_count)); } while (zend_hash_add(EG(function_table), function_name, function_name_length+1, new_function, sizeof(zend_function), NULL)==FAILURE); zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)); RETURN_STRINGL(function_name, function_name_length, 0); Modified: php/php-src/branches/PHP_5_4/Zend/zend_builtin_functions.c === --- php/php-src/branches/PHP_5_4/Zend/zend_builtin_functions.c 2011-08-08 14:52:34 UTC (rev 314526) +++ php/php-src/branches/PHP_5_4/Zend/zend_builtin_functions.c 2011-08-08 14:54:50 UTC (rev 314527) @@ -1821,7 +1821,7 @@ function_name[0] = '\0'; do { - function_name_length = 1 + snprintf(function_name + 1, sizeof(0lambda_)+MAX_LENGTH_OF_LONG, lambda_%d, ++EG(lambda_count)); + function_name_length = 1 + snprintf(function_name + 1, sizeof(lambda_)+MAX_LENGTH_OF_LONG, lambda_%d, ++EG(lambda_count)); } while (zend_hash_add(EG(function_table), function_name, function_name_length+1, new_function, sizeof(zend_function), NULL)==FAILURE); zend_hash_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)); RETURN_STRINGL(function_name, function_name_length, 0); -- 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_4/ext/spl/spl_dllist.c branches/PHP_5_4/ext/spl/tests/SplDoublyLinkedList_serialization.phpt trunk/ext/spl/spl_dllist.c trunk/ext/spl/tests/SplDoublyLinkedL
colder Tue, 12 Jul 2011 21:43:17 + Revision: http://svn.php.net/viewvc?view=revisionrevision=313183 Log: Fix #48860 Implement Serialization for DLL Bug: https://bugs.php.net/48860 (Assigned) SplQueue objects can not be stored in session Changed paths: U php/php-src/branches/PHP_5_4/ext/spl/spl_dllist.c A php/php-src/branches/PHP_5_4/ext/spl/tests/SplDoublyLinkedList_serialization.phpt U php/php-src/trunk/ext/spl/spl_dllist.c A php/php-src/trunk/ext/spl/tests/SplDoublyLinkedList_serialization.phpt Modified: php/php-src/branches/PHP_5_4/ext/spl/spl_dllist.c === --- php/php-src/branches/PHP_5_4/ext/spl/spl_dllist.c 2011-07-12 19:57:55 UTC (rev 313182) +++ php/php-src/branches/PHP_5_4/ext/spl/spl_dllist.c 2011-07-12 21:43:17 UTC (rev 313183) @@ -27,6 +27,9 @@ #include zend_hash.h #include php_spl.h +#include ext/standard/info.h +#include ext/standard/php_var.h +#include ext/standard/php_smart_str.h #include spl_functions.h #include spl_engine.h #include spl_iterators.h @@ -1129,7 +1132,109 @@ } } /* }}} */ +/* {{{ proto string SplDoublyLinkedList::serialize() + Serializes storage */ +SPL_METHOD(SplDoublyLinkedList, serialize) +{ + spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + smart_str buf = {0}; + spl_ptr_llist_element *current = intern-llist-head, *next; +zval *flags; + php_serialize_data_t var_hash; + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + PHP_VAR_SERIALIZE_INIT(var_hash); + + /* flags */ + MAKE_STD_ZVAL(flags); + ZVAL_LONG(flags, intern-flags); + php_var_serialize(buf, flags, var_hash TSRMLS_CC); + zval_ptr_dtor(flags); + + /* elements */ + while (current) { + smart_str_appendc(buf, ':'); + next = current-next; + + php_var_serialize(buf, (zval **)current-data, var_hash TSRMLS_CC); + + current = next; + } + + smart_str_0(buf); + + /* done */ + PHP_VAR_SERIALIZE_DESTROY(var_hash); + + if (buf.c) { + RETURN_STRINGL(buf.c, buf.len, 0); + } else { + RETURN_NULL(); + } + +} /* }}} */ + +/* {{{ proto void SplDoublyLinkedList::unserialize(string serialized) + Unserializes storage */ +SPL_METHOD(SplDoublyLinkedList, unserialize) +{ + spl_dllist_object *intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + zval *flags, *elem; + char *buf; + int buf_len; + const unsigned char *p, *s; + php_unserialize_data_t var_hash; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, buf, buf_len) == FAILURE) { + return; + } + + if (buf_len == 0) { + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, Serialized string cannot be empty); + return; + } + + s = p = (const unsigned char*)buf; + PHP_VAR_UNSERIALIZE_INIT(var_hash); + + /* flags */ + ALLOC_INIT_ZVAL(flags); + if (!php_var_unserialize(elem, p, s + buf_len, var_hash TSRMLS_CC) || Z_TYPE_P(elem) != IS_LONG) { + zval_ptr_dtor(flags); + goto error; + } + intern-flags = Z_LVAL_P(elem); + zval_ptr_dtor(flags); + + /* elements */ + while(*p == ':') { + ++p; + ALLOC_INIT_ZVAL(elem); + if (!php_var_unserialize(elem, p, s + buf_len, var_hash TSRMLS_CC)) { + zval_ptr_dtor(elem); + goto error; + } + + spl_ptr_llist_push(intern-llist, elem TSRMLS_CC); + } + + if (*p != '\0') { + goto error; + } + + PHP_VAR_UNSERIALIZE_DESTROY(var_hash); + return; + +error: + PHP_VAR_UNSERIALIZE_DESTROY(var_hash); + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, Error at offset %ld of %d bytes, (long)((char*)p - buf), buf_len); + return; + +} /* }}} */ + /* iterator handler table */ zend_object_iterator_funcs spl_dllist_it_funcs = { spl_dllist_it_dtor, @@ -1190,6 +1295,10 @@ ZEND_BEGIN_ARG_INFO(arginfo_dllist_void, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO(arginfo_dllist_serialized, 0) + ZEND_ARG_INFO(0, serialized) +ZEND_END_ARG_INFO(); + static const zend_function_entry spl_funcs_SplQueue[] = { SPL_MA(SplQueue, enqueue, SplDoublyLinkedList, push, arginfo_dllist_push, ZEND_ACC_PUBLIC) SPL_MA(SplQueue, dequeue, SplDoublyLinkedList, shift, arginfo_dllist_void, ZEND_ACC_PUBLIC) @@ -1203,20 +1312,26 @@ SPL_ME(SplDoublyLinkedList, unshift, arginfo_dllist_push,ZEND_ACC_PUBLIC) SPL_ME(SplDoublyLinkedList, top, arginfo_dllist_void,ZEND_ACC_PUBLIC) SPL_ME(SplDoublyLinkedList, bottom, arginfo_dllist_void,ZEND_ACC_PUBLIC) - SPL_ME(SplDoublyLinkedList, count, arginfo_dllist_void,ZEND_ACC_PUBLIC) SPL_ME(SplDoublyLinkedList, isEmpty, arginfo_dllist_void,ZEND_ACC_PUBLIC) SPL_ME(SplDoublyLinkedList, setIteratorMode, arginfo_dllist_setiteratormode, ZEND_ACC_PUBLIC) SPL_ME(SplDoublyLinkedList, getIteratorMode, arginfo_dllist_void,ZEND_ACC_PUBLIC) + /* Countable */ +
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/spl/spl_dllist.c trunk/ext/spl/spl_dllist.c
colder Tue, 12 Jul 2011 21:57:14 + Revision: http://svn.php.net/viewvc?view=revisionrevision=313184 Log: Fix crash Changed paths: U php/php-src/branches/PHP_5_4/ext/spl/spl_dllist.c U php/php-src/trunk/ext/spl/spl_dllist.c Modified: php/php-src/branches/PHP_5_4/ext/spl/spl_dllist.c === --- php/php-src/branches/PHP_5_4/ext/spl/spl_dllist.c 2011-07-12 21:43:17 UTC (rev 313183) +++ php/php-src/branches/PHP_5_4/ext/spl/spl_dllist.c 2011-07-12 21:57:14 UTC (rev 313184) @@ -1202,11 +1202,11 @@ /* flags */ ALLOC_INIT_ZVAL(flags); - if (!php_var_unserialize(elem, p, s + buf_len, var_hash TSRMLS_CC) || Z_TYPE_P(elem) != IS_LONG) { + if (!php_var_unserialize(flags, p, s + buf_len, var_hash TSRMLS_CC) || Z_TYPE_P(flags) != IS_LONG) { zval_ptr_dtor(flags); goto error; } - intern-flags = Z_LVAL_P(elem); + intern-flags = Z_LVAL_P(flags); zval_ptr_dtor(flags); /* elements */ Modified: php/php-src/trunk/ext/spl/spl_dllist.c === --- php/php-src/trunk/ext/spl/spl_dllist.c 2011-07-12 21:43:17 UTC (rev 313183) +++ php/php-src/trunk/ext/spl/spl_dllist.c 2011-07-12 21:57:14 UTC (rev 313184) @@ -1202,11 +1202,11 @@ /* flags */ ALLOC_INIT_ZVAL(flags); - if (!php_var_unserialize(elem, p, s + buf_len, var_hash TSRMLS_CC) || Z_TYPE_P(elem) != IS_LONG) { + if (!php_var_unserialize(flags, p, s + buf_len, var_hash TSRMLS_CC) || Z_TYPE_P(flags) != IS_LONG) { zval_ptr_dtor(flags); goto error; } - intern-flags = Z_LVAL_P(elem); + intern-flags = Z_LVAL_P(flags); zval_ptr_dtor(flags); /* elements */ -- 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/spl/spl_observer.c branches/PHP_5_3/ext/spl/tests/SplObjectStorage_removeAllExcept_basic.phpt branches/PHP_5_3/ext/spl/tests/SplObjectStorage_removeAl
colder Wed, 05 Jan 2011 15:01:18 + Revision: http://svn.php.net/viewvc?view=revisionrevision=307129 Log: Implement SplObjectStorage::removeAllExcept (Patch by Matthey Turland) Changed paths: U php/php-src/branches/PHP_5_3/ext/spl/spl_observer.c A php/php-src/branches/PHP_5_3/ext/spl/tests/SplObjectStorage_removeAllExcept_basic.phpt A php/php-src/branches/PHP_5_3/ext/spl/tests/SplObjectStorage_removeAllExcept_invalid_parameter.phpt U php/php-src/trunk/ext/spl/spl_observer.c A php/php-src/trunk/ext/spl/tests/SplObjectStorage_removeAllExcept_basic.phpt A php/php-src/trunk/ext/spl/tests/SplObjectStorage_removeAllExcept_invalid_parameter.phpt Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_observer.c === --- php/php-src/branches/PHP_5_3/ext/spl/spl_observer.c 2011-01-05 14:57:13 UTC (rev 307128) +++ php/php-src/branches/PHP_5_3/ext/spl/spl_observer.c 2011-01-05 15:01:18 UTC (rev 307129) @@ -485,6 +485,36 @@ RETURN_LONG(zend_hash_num_elements(intern-storage)); } /* }}} */ +/* {{{ proto bool SplObjectStorage::removeAllExcept(SplObjectStorage $os) + Remove elements not common to both this SplObjectStorage instance and $os */ +SPL_METHOD(SplObjectStorage, removeAllExcept) +{ + zval *obj; + spl_SplObjectStorage *intern = (spl_SplObjectStorage *)zend_object_store_get_object(getThis() TSRMLS_CC); + spl_SplObjectStorage *other; + spl_SplObjectStorageElement *element; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, O, obj, spl_ce_SplObjectStorage) == FAILURE) { + return; + } + + other = (spl_SplObjectStorage *)zend_object_store_get_object(obj TSRMLS_CC); + + zend_hash_internal_pointer_reset(intern-storage); + while (zend_hash_get_current_data(intern-storage, (void **)element) == SUCCESS) { + if (!spl_object_storage_contains(other, element-obj TSRMLS_CC)) { + spl_object_storage_detach(intern, element-obj TSRMLS_CC); + } + zend_hash_move_forward(intern-storage); + } + + zend_hash_internal_pointer_reset_ex(intern-storage, intern-pos); + intern-index = 0; + + RETURN_LONG(zend_hash_num_elements(intern-storage)); +} +/* }}} */ + /* {{{ proto bool SplObjectStorage::contains($obj) Determine whethe an object is contained in the storage */ SPL_METHOD(SplObjectStorage, contains) @@ -827,6 +857,7 @@ SPL_ME(SplObjectStorage, contains,arginfo_Object,0) SPL_ME(SplObjectStorage, addAll, arginfo_Object,0) SPL_ME(SplObjectStorage, removeAll, arginfo_Object,0) + SPL_ME(SplObjectStorage, removeAllExcept, arginfo_Object,0) SPL_ME(SplObjectStorage, getInfo, arginfo_splobject_void,0) SPL_ME(SplObjectStorage, setInfo, arginfo_setInfo, 0) /* Countable */ Added: php/php-src/branches/PHP_5_3/ext/spl/tests/SplObjectStorage_removeAllExcept_basic.phpt === --- php/php-src/branches/PHP_5_3/ext/spl/tests/SplObjectStorage_removeAllExcept_basic.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/spl/tests/SplObjectStorage_removeAllExcept_basic.phpt 2011-01-05 15:01:18 UTC (rev 307129) @@ -0,0 +1,27 @@ +--TEST-- +Check that SplObjectStorage::removeUncommon functions when receiving proper input +--CREDITS-- +Matthew Turland (m...@matthewturland.com) +--FILE-- +?php + +$a = (object) 'a'; +$b = (object) 'b'; +$c = (object) 'c'; + + $foo = new SplObjectStorage; +$foo-attach($a); +$foo-attach($b); + +$bar = new SplObjectStorage; +$bar-attach($b); +$bar-attach($c); + +$foo-removeAllExcept($bar); +var_dump($foo-contains($a)); +var_dump($foo-contains($b)); + +? +--EXPECT-- +bool(false) +bool(true) Added: php/php-src/branches/PHP_5_3/ext/spl/tests/SplObjectStorage_removeAllExcept_invalid_parameter.phpt === --- php/php-src/branches/PHP_5_3/ext/spl/tests/SplObjectStorage_removeAllExcept_invalid_parameter.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/spl/tests/SplObjectStorage_removeAllExcept_invalid_parameter.phpt 2011-01-05 15:01:18 UTC (rev 307129) @@ -0,0 +1,44 @@ +--TEST-- +Check that SplObjectStorage::removeAllExcept generate a warning and returns NULL when passed non-object param +--CREDITS-- +Matthew Turland (m...@matthewturland.com) +Based on work done at PHPNW Testfest 2009 by Simon Westcott (swestc...@gmail.com) +--FILE-- +?php + +$data_provider = array( + array(), + true, + string, + 12345, + 1.2345, + NULL +); + +foreach($data_provider as $input) { + + $s = new SplObjectStorage(); + + var_dump($s-removeAllExcept($input)); +} + +? +--EXPECTF-- +Warning: SplObjectStorage::removeAllExcept() expects parameter 1 to be SplObjectStorage, array given in %s on line %d +NULL + +Warning: SplObjectStorage::removeAllExcept() expects parameter 1 to be SplObjectStorage, boolean given in %s on
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/Zend/tests/objects_032.phpt branches/PHP_5_3/Zend/zend_compile.c trunk/Zend/tests/objects_032.phpt trunk/Zend/zend_compile.c
colder Wed, 03 Nov 2010 15:40:24 + Revision: http://svn.php.net/viewvc?view=revisionrevision=305057 Log: Fixed covariance of return-by-ref constraints Changed paths: U php/php-src/branches/PHP_5_3/NEWS A php/php-src/branches/PHP_5_3/Zend/tests/objects_032.phpt U php/php-src/branches/PHP_5_3/Zend/zend_compile.c A php/php-src/trunk/Zend/tests/objects_032.phpt U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2010-11-03 14:26:32 UTC (rev 305056) +++ php/php-src/branches/PHP_5_3/NEWS 2010-11-03 15:40:24 UTC (rev 305057) @@ -50,6 +50,7 @@ large amount of data) (CVE-2010-3710). (Adam) - Fixed ReflectionProperty::isDefault() giving a wrong result for properties obtained with ReflectionClass::getProperties(). (Gustavo) +- Fixed covariance of return-by-ref constraints. (Etienne) - Fixed bug #53198 (changing INI setting from with ini_set did not have any effect). (Gustavo) Added: php/php-src/branches/PHP_5_3/Zend/tests/objects_032.phpt === --- php/php-src/branches/PHP_5_3/Zend/tests/objects_032.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/Zend/tests/objects_032.phpt2010-11-03 15:40:24 UTC (rev 305057) @@ -0,0 +1,40 @@ +--TEST-- +Covariant return-by-ref constraints +--FILE-- +?php + +class A implements ArrayAccess { +public $foo = array(); + +public function offsetGet($n) { +return $this-foo[$n]; +} + +public function offsetSet($n, $v) { +} +public function offsetUnset($n) { +} +public function offsetExists($n) { +} +} + +$a = new A; + +$a['foo']['bar'] = 2; + +var_dump($a); + +? +==DONE== +--EXPECTF-- +object(A)#1 (1) { + [foo]= + array(1) { +[foo]= +array(1) { + [bar]= + int(2) +} + } +} +==DONE== Modified: php/php-src/branches/PHP_5_3/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_3/Zend/zend_compile.c2010-11-03 14:26:32 UTC (rev 305056) +++ php/php-src/branches/PHP_5_3/Zend/zend_compile.c2010-11-03 15:40:24 UTC (rev 305057) @@ -2557,7 +2557,8 @@ return 0; } - if (fe-common.return_reference != proto-common.return_reference) { + /* by-ref constraints on return values are covariant */ + if (proto-common.return_reference !fe-common.return_reference) { return 0; } @@ -2581,6 +2582,8 @@ /* Only one has an array type hint and the other one doesn't */ return 0; } + + /* by-ref constraints on arguments are invariant */ if (fe-common.arg_info[i].pass_by_reference != proto-common.arg_info[i].pass_by_reference) { return 0; } Added: php/php-src/trunk/Zend/tests/objects_032.phpt === --- php/php-src/trunk/Zend/tests/objects_032.phpt (rev 0) +++ php/php-src/trunk/Zend/tests/objects_032.phpt 2010-11-03 15:40:24 UTC (rev 305057) @@ -0,0 +1,40 @@ +--TEST-- +Covariant return-by-ref constraints +--FILE-- +?php + +class A implements ArrayAccess { +public $foo = array(); + +public function offsetGet($n) { +return $this-foo[$n]; +} + +public function offsetSet($n, $v) { +} +public function offsetUnset($n) { +} +public function offsetExists($n) { +} +} + +$a = new A; + +$a['foo']['bar'] = 2; + +var_dump($a); + +? +==DONE== +--EXPECTF-- +object(A)#1 (1) { + [foo]= + array(1) { +[foo]= +array(1) { + [bar]= + int(2) +} + } +} +==DONE== Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2010-11-03 14:26:32 UTC (rev 305056) +++ php/php-src/trunk/Zend/zend_compile.c 2010-11-03 15:40:24 UTC (rev 305057) @@ -2956,8 +2956,9 @@ return 0; } - if ((fe-common.fn_flags ZEND_ACC_RETURN_REFERENCE) != - (proto-common.fn_flags ZEND_ACC_RETURN_REFERENCE)) { + /* by-ref constraints on return values are covariant */ + if ((proto-common.fn_flags ZEND_ACC_RETURN_REFERENCE) +!(fe-common.fn_flags ZEND_ACC_RETURN_REFERENCE)) { return 0; } @@ -2981,6 +2982,8 @@ /* Incompatible type hint */ return 0; } + + /* by-ref constraints on arguments are invariant */ if (fe-common.arg_info[i].pass_by_reference != proto-common.arg_info[i].pass_by_reference) { return 0; } -- PHP CVS
[PHP-CVS] svn: /php/php-src/branches/LEMON/ext/tokenizer/ tokenizer_data.c
colder Sat, 10 Jul 2010 10:29:29 + Revision: http://svn.php.net/viewvc?view=revisionrevision=301148 Log: Remove T_T_DOLLAR Changed paths: U php/php-src/branches/LEMON/ext/tokenizer/tokenizer_data.c Modified: php/php-src/branches/LEMON/ext/tokenizer/tokenizer_data.c === --- php/php-src/branches/LEMON/ext/tokenizer/tokenizer_data.c 2010-07-10 00:50:56 UTC (rev 301147) +++ php/php-src/branches/LEMON/ext/tokenizer/tokenizer_data.c 2010-07-10 10:29:29 UTC (rev 301148) @@ -170,7 +170,6 @@ REGISTER_LONG_CONSTANT(T_STRING_VARNAME, T_STRING_VARNAME, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(T_QUOTE, T_QUOTE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(T_LBRACKET, T_LBRACKET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT(T_T_DOLLAR, T_T_DOLLAR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(T_LIST, T_LIST, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(T_DOLLAR_OPEN_CURLY_BRACES, T_DOLLAR_OPEN_CURLY_BRACES, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(T_CURLY_OPEN, T_CURLY_OPEN, CONST_CS | CONST_PERSISTENT); @@ -339,7 +338,6 @@ case T_STRING_VARNAME: return T_STRING_VARNAME; case T_QUOTE: return T_QUOTE; case T_LBRACKET: return T_LBRACKET; - case T_T_DOLLAR: return T_T_DOLLAR; case T_LIST: return T_LIST; case T_DOLLAR_OPEN_CURLY_BRACES: return T_DOLLAR_OPEN_CURLY_BRACES; case T_CURLY_OPEN: return T_CURLY_OPEN; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/LEMON/ Makefile.frag Zend/Makefile.am Zend/zend_language_parser.y
colder Sat, 10 Jul 2010 11:10:38 + Revision: http://svn.php.net/viewvc?view=revisionrevision=301149 Log: Fix lemon's return value and uncomment unaries/shifts Changed paths: U php/php-src/branches/LEMON/Makefile.frag U php/php-src/branches/LEMON/Zend/Makefile.am U php/php-src/branches/LEMON/Zend/zend_language_parser.y Modified: php/php-src/branches/LEMON/Makefile.frag === --- php/php-src/branches/LEMON/Makefile.frag2010-07-10 10:29:29 UTC (rev 301148) +++ php/php-src/branches/LEMON/Makefile.frag2010-07-10 11:10:38 UTC (rev 301149) @@ -11,7 +11,7 @@ $(srcdir)/zend_language_parser.h: $(srcdir)/zend_language_parser.c $(srcdir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y - $(LEMON) $(LEMON_FLAGS) $(srcdir)/zend_language_parser.y || test $$? -eq 25 + $(LEMON) $(LEMON_FLAGS) $(srcdir)/zend_language_parser.y || test $$? -eq 2 $(srcdir)/zend_ini_parser.h: $(srcdir)/zend_ini_parser.c $(srcdir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y Modified: php/php-src/branches/LEMON/Zend/Makefile.am === --- php/php-src/branches/LEMON/Zend/Makefile.am 2010-07-10 10:29:29 UTC (rev 301148) +++ php/php-src/branches/LEMON/Zend/Makefile.am 2010-07-10 11:10:38 UTC (rev 301149) @@ -35,7 +35,7 @@ zend_language_parser.h: zend_language_parser.c zend_language_parser.c: $(srcdir)/zend_language_parser.y - $(LEMON) $(LEMON_FLAGS) $(srcdir)/zend_language_parser.y || test $$? -eq 25 + $(LEMON) $(LEMON_FLAGS) $(srcdir)/zend_language_parser.y || test $$? -eq 2 # INI parser/scanner rules Modified: php/php-src/branches/LEMON/Zend/zend_language_parser.y === --- php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-10 10:29:29 UTC (rev 301148) +++ php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-10 11:10:38 UTC (rev 301149) @@ -1084,10 +1084,10 @@ expr_without_variable(A) ::= expr(B) MULT expr(C). { zend_do_binary_op(ZEND_MUL, A, B, C TSRMLS_CC); } expr_without_variable(A) ::= expr(B) DIV expr(C). { zend_do_binary_op(ZEND_DIV, A, B, C TSRMLS_CC); } expr_without_variable(A) ::= expr(B) MOD expr(C). { zend_do_binary_op(ZEND_MOD, A, B, C TSRMLS_CC); } -//expr_without_variable(A) ::= expr(B) SL expr(C). { zend_do_binary_op(ZEND_SL, A, B, C TSRMLS_CC); } -//expr_without_variable(A) ::= expr(B) SR expr(C). { zend_do_binary_op(ZEND_SR, A, B, C TSRMLS_CC); } -//expr_without_variable(A) ::= PLUS(B) expr(C). [INC] { ZVAL_LONG(B.u.constant, 0); if (C.op_type == IS_CONST) { add_function(C.u.constant, B.u.constant, C.u.constant TSRMLS_CC); A = C; } else { B.op_type = IS_CONST; INIT_PZVAL(B.u.constant); zend_do_binary_op(ZEND_ADD, A, B, C TSRMLS_CC); } } -//expr_without_variable(A) ::= MINUS(B) expr(C). [INC] { ZVAL_LONG(B.u.constant, 0); if (C.op_type == IS_CONST) { sub_function(C.u.constant, B.u.constant, C.u.constant TSRMLS_CC); A = C; } else { B.op_type = IS_CONST; INIT_PZVAL(B.u.constant); zend_do_binary_op(ZEND_SUB, A, B, C TSRMLS_CC); } } +expr_without_variable(A) ::= expr(B) SL expr(C). { zend_do_binary_op(ZEND_SL, A, B, C TSRMLS_CC); } +expr_without_variable(A) ::= expr(B) SR expr(C). { zend_do_binary_op(ZEND_SR, A, B, C TSRMLS_CC); } +expr_without_variable(A) ::= PLUS(B) expr(C). [INC] { ZVAL_LONG(B.u.constant, 0); if (C.op_type == IS_CONST) { add_function(C.u.constant, B.u.constant, C.u.constant TSRMLS_CC); A = C; } else { B.op_type = IS_CONST; INIT_PZVAL(B.u.constant); zend_do_binary_op(ZEND_ADD, A, B, C TSRMLS_CC); } } +expr_without_variable(A) ::= MINUS(B) expr(C). [INC] { ZVAL_LONG(B.u.constant, 0); if (C.op_type == IS_CONST) { sub_function(C.u.constant, B.u.constant, C.u.constant TSRMLS_CC); A = C; } else { B.op_type = IS_CONST; INIT_PZVAL(B.u.constant); zend_do_binary_op(ZEND_SUB, A, B, C TSRMLS_CC); } } expr_without_variable(A) ::= BOOL_NOT expr(B). { zend_do_unary_op(ZEND_BOOL_NOT, A, B TSRMLS_CC); } expr_without_variable(A) ::= BW_NOT expr(B). { zend_do_unary_op(ZEND_BW_NOT, A, B TSRMLS_CC); } expr_without_variable(A) ::= expr(B) IS_IDENTICAL expr(C). { zend_do_binary_op(ZEND_IS_IDENTICAL, A, B, C TSRMLS_CC); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/LEMON/Zend/ zend_language_parser.y
colder Fri, 09 Jul 2010 09:28:39 + Revision: http://svn.php.net/viewvc?view=revisionrevision=301110 Log: Some fixes Changed paths: U php/php-src/branches/LEMON/Zend/zend_language_parser.y Modified: php/php-src/branches/LEMON/Zend/zend_language_parser.y === --- php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 09:02:14 UTC (rev 301109) +++ php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 09:28:39 UTC (rev 301110) @@ -72,6 +72,7 @@ %type isset_variables_i {znode_array} %type unticked_class_declaration_statement_i {znode_array} %type unticked_class_declaration_statement_ii {znode_array} +%type while_cond {znode_array} /* TOKENS TRANSLATION: @@ -170,6 +171,8 @@ // | constant_declaration SEMICOLON { zend_verify_namespace(TSRMLS_C); } //; +namespace_start ::= NAMESPACE LBRACE. { zend_do_begin_namespace(NULL, 1 TSRMLS_CC); } + top_statement ::= statement. { zend_verify_namespace(TSRMLS_C); } top_statement ::= function_declaration_statement. { zend_verify_namespace(TSRMLS_C); zend_do_early_binding(TSRMLS_C); } top_statement ::= class_declaration_statement. { zend_verify_namespace(TSRMLS_C); zend_do_early_binding(TSRMLS_C); } @@ -177,8 +180,7 @@ top_statement ::= NAMESPACE namespace_name(B) SEMICOLON. { zend_do_begin_namespace(B, 0 TSRMLS_CC); } top_statement ::= NAMESPACE namespace_name(B) LBRACE. { zend_do_begin_namespace(B, 1 TSRMLS_CC); } top_statement ::= top_statement_list RBRACE. { zend_do_end_namespace(TSRMLS_C); } -top_statement ::= NAMESPACE LBRACE.{ zend_do_begin_namespace(NULL, 1 TSRMLS_CC); } -top_statement ::= top_statement_list RBRACE. { zend_do_end_namespace(TSRMLS_C); } +top_statement ::= namespace_start top_statement_list RBRACE. { zend_do_end_namespace(TSRMLS_C); } top_statement ::= USE use_declarations SEMICOLON. { zend_verify_namespace(TSRMLS_C); } top_statement ::= constant_declaration SEMICOLON.{ zend_verify_namespace(TSRMLS_C); } // Just to make the build works @@ -297,23 +299,24 @@ if_alt_cond(A) ::= IF LPAREN expr(B) RPAREN(C) COLON. { zend_do_if_cond(B, C TSRMLS_CC); A = C; } if_alt_cond_then ::= if_alt_cond(B) inner_statement_list. { zend_do_if_after_statement(B, 1 TSRMLS_CC); } -while_begin ::= WHILE(B) LPAREN. { B.u.op.opline_num = get_next_op_number(CG(active_op_array)); } +while_begin(A) ::= WHILE(B) LPAREN. { B.u.op.opline_num = get_next_op_number(CG(active_op_array)); A = B } +while_cond(A) ::= while_begin(B) expr(C) RPAREN(D). { zend_do_while_cond(C, D TSRMLS_CC); A[0] = B; A[1] = D } +unticked_statement ::= while_cond(B) while_statement. { zend_do_while_end(B[0], B[1] TSRMLS_CC); } -/* FIXME -unticked_statement ::= while_begin expr RPAREN { zend_do_while_cond($4, $5 TSRMLS_CC); } while_statement { zend_do_while_end($1, $5 TSRMLS_CC); } -unticked_statement ::= DO { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_do_while_begin(TSRMLS_C); } statement WHILE LPAREN { $5.u.op.opline_num = get_next_op_number(CG(active_op_array)); } expr RPAREN SEMICOLON { zend_do_do_while_end($1, $5, $7 TSRMLS_CC); } -unticked_statement ::= FOR -LPAREN -for_expr -SEMICOLON { zend_do_free($3 TSRMLS_CC); $4.u.op.opline_num = get_next_op_number(CG(active_op_array)); } -for_expr -SEMICOLON { zend_do_extended_info(TSRMLS_C); zend_do_for_cond($6, $7 TSRMLS_CC); } -for_expr -RPAREN { zend_do_free($9 TSRMLS_CC); zend_do_for_before_statement($4, $7 TSRMLS_CC); } -for_statement { zend_do_for_end($7 TSRMLS_CC); } -*/ -unticked_statement ::= switch. +do_start(A) ::= DO. { A.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_do_while_begin(TSRMLS_C); } +do_statement(A) ::= do_start(B) statement WHILE LPAREN(C). { C.u.op.opline_num = get_next_op_number(CG(active_op_array)); A[0] = B; A[1] = C; } +unticked_statement ::= do_statement(B) expr(C) RPAREN SEMICOLON. { zend_do_do_while_end(B[0], B[1], C TSRMLS_CC); } + +for_begin(A) ::= FOR LPAREN for_expr(B) SEMICOLON(C). { zend_do_free(B TSRMLS_CC); C.u.op.opline_num = get_next_op_number(CG(active_op_array)); A = C; } +for_cont(A) ::= for_begin(B) for_expr(C) SEMICOLON(D). { zend_do_extended_info(TSRMLS_C); zend_do_for_cond(C, D TSRMLS_CC); A[0] = B; A[1] = D; } +for_cont_2(A) ::= for_cont(B) for_expr(C) RPAREN. { zend_do_free(C TSRMLS_CC); zend_do_for_before_statement(B[0], B[1] TSRMLS_CC); A = B[1]; } + +unticked_statement ::= for_cont_2(B) for_statement. { zend_do_for_end(B TSRMLS_CC); } + +switch_i ::=
[PHP-CVS] svn: /php/php-src/branches/LEMON/Zend/ zend_language_parser.y
colder Fri, 09 Jul 2010 09:43:07 + Revision: http://svn.php.net/viewvc?view=revisionrevision=301113 Log: Fix some stuff Changed paths: U php/php-src/branches/LEMON/Zend/zend_language_parser.y Modified: php/php-src/branches/LEMON/Zend/zend_language_parser.y === --- php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 09:38:38 UTC (rev 301112) +++ php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 09:43:07 UTC (rev 301113) @@ -73,6 +73,8 @@ %type unticked_class_declaration_statement_i {znode_array} %type unticked_class_declaration_statement_ii {znode_array} %type while_cond {znode_array} +%type do_statement {znode_array} +%type for_cont {znode_array} /* TOKENS TRANSLATION: @@ -299,8 +301,8 @@ if_alt_cond(A) ::= IF LPAREN expr(B) RPAREN(C) COLON. { zend_do_if_cond(B, C TSRMLS_CC); A = C; } if_alt_cond_then ::= if_alt_cond(B) inner_statement_list. { zend_do_if_after_statement(B, 1 TSRMLS_CC); } -while_begin(A) ::= WHILE(B) LPAREN. { B.u.op.opline_num = get_next_op_number(CG(active_op_array)); A = B } -while_cond(A) ::= while_begin(B) expr(C) RPAREN(D). { zend_do_while_cond(C, D TSRMLS_CC); A[0] = B; A[1] = D } +while_begin(A) ::= WHILE(B) LPAREN. { B.u.op.opline_num = get_next_op_number(CG(active_op_array)); A = B; } +while_cond(A) ::= while_begin(B) expr(C) RPAREN(D). { zend_do_while_cond(C, D TSRMLS_CC); A[0] = B; A[1] = D; } unticked_statement ::= while_cond(B) while_statement. { zend_do_while_end(B[0], B[1] TSRMLS_CC); } @@ -348,13 +350,13 @@ foreach_i(A) ::= foreach_ii(B) foreach_variable(C) foreach_optional_arg(D) RPAREN. { zend_do_foreach_cont(B[0], B[1], B[2], C, D TSRMLS_CC); A[0] = B[0]; A[1] = B[2]; } foreach ::= foreach_i(B) foreach_statement. { zend_do_foreach_end(B[0], B[1] TSRMLS_CC); } -foreach2_ii(A) ::= FOREACH(B) LPAREN(C) expr_without_variable(D) AS(E). { zend_do_foreach_begin(A, B, C, D, 0 TSRMLS_CC); A[0] = B; A[1] = C; A[2] = E; } +foreach2_ii(A) ::= FOREACH(B) LPAREN(C) expr_without_variable(D) AS(E). { zend_do_foreach_begin(B, C, D, E, 0 TSRMLS_CC); A[0] = B; A[1] = C; A[2] = E; } foreach2_i(A) ::= foreach2_ii(B) variable(C) foreach_optional_arg(D) RPAREN. { zend_check_writable_variable(C); zend_do_foreach_cont(B[0], B[1], B[2], C, D TSRMLS_CC); A[0] = B[0]; A[1] = B[2]; } foreach2 ::= foreach2_i(B) foreach_statement. { zend_do_foreach_end(B[0], B[1] TSRMLS_CC); } try_catch_v(A) ::= TRY(B). { zend_do_try(B TSRMLS_CC); A = B; } try_catch_iv(A) ::= try_catch_v(B) LBRACE inner_statement_list RBRACE CATCH LPAREN(C). { zend_initialize_try_catch_element(B TSRMLS_CC); A[0] = B; A[1] = C; } -try_catch_iii(A) ::= try_catch_iv(B) fully_qualified_class_name(C). { zend_do_first_catch(B TSRMLS_CC); A[0] = B[0]; A[1] = B[1]; A[2] = C; } +try_catch_iii(A) ::= try_catch_iv(B) fully_qualified_class_name(C). { zend_do_first_catch(B[1] TSRMLS_CC); A[0] = B[0]; A[1] = B[1]; A[2] = C; } try_catch_ii(A) ::= try_catch_iii(B) VARIABLE(C) RPAREN. { zend_do_begin_catch(B[0], B[2], C, B[1] TSRMLS_CC); A = B[0]; } try_catch_i(A) ::= try_catch_ii(B) LBRACE inner_statement_list RBRACE. { zend_do_end_catch(B TSRMLS_CC); A = B; } try_catch::= try_catch_i(B) additional_catches(C). { zend_do_mark_last_catch(B, C TSRMLS_CC); } @@ -1412,9 +1414,16 @@ non_empty_static_array_pair_list(A) ::= non_empty_static_array_pair_list COMMA static_scalar(B) DOUBLE_ARROW static_scalar(C). { zend_do_add_static_array_element(A, B, C); } non_empty_static_array_pair_list(A) ::= non_empty_static_array_pair_list COMMA static_scalar(B). { zend_do_add_static_array_element(A, NULL, B); } -non_empty_static_array_pair_list(A) ::= static_scalar(B) DOUBLE_ARROW static_scalar(C). { A.op_type = IS_CONST; INIT_PZVAL(A.u.constant); array_init(A.u.constant); zend_do_add_static_array_element(A, B, C); } -non_empty_static_array_pair_list(A) ::= static_scalar(B). { A.op_type = IS_CONST; INIT_PZVAL(A.u.constant); array_init(A.u.constant); zend_do_add_static_array_element(A, NULL, B); } +non_empty_static_array_pair_list(A) ::= static_scalar(B) DOUBLE_ARROW static_scalar(C). { A.op_type = IS_CONST; + INIT_PZVAL(A.u.constant); + array_init(A.u.constant); + zend_do_add_static_array_element(A, B, C); } +non_empty_static_array_pair_list(A) ::= static_scalar(B). { A.op_type = IS_CONST; + INIT_PZVAL(A.u.constant); + array_init(A.u.constant); + zend_do_add_static_array_element(A,
[PHP-CVS] svn: /php/php-src/branches/LEMON/Zend/ zend_language_parser.y
colder Fri, 09 Jul 2010 11:24:11 + Revision: http://svn.php.net/viewvc?view=revisionrevision=301116 Log: todo no longer needed, + A is always on the result side Changed paths: U php/php-src/branches/LEMON/Zend/zend_language_parser.y Modified: php/php-src/branches/LEMON/Zend/zend_language_parser.y === --- php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 09:58:13 UTC (rev 301115) +++ php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 11:24:11 UTC (rev 301116) @@ -185,8 +185,6 @@ top_statement ::= namespace_start top_statement_list RBRACE. { zend_do_end_namespace(TSRMLS_C); } top_statement ::= USE use_declarations SEMICOLON. { zend_verify_namespace(TSRMLS_C); } top_statement ::= constant_declaration SEMICOLON.{ zend_verify_namespace(TSRMLS_C); } -// Just to make the build works -top_statement ::= todo. //use_declarations: // use_declarations COMMA use_declaration @@ -244,7 +242,7 @@ //; statement ::= unticked_statement. { zend_do_ticks(TSRMLS_C); } -statement ::= STRING(A) COLON. { zend_do_label(A TSRMLS_CC); } +statement ::= STRING(B) COLON. { zend_do_label(A TSRMLS_CC); } //unticked_statement: // LBRACE inner_statement_list RBRACE @@ -1761,15 +1759,6 @@ class_constant(A) ::= class_name(B) PAAMAYIM_NEKUDOTAYIM STRING(C). { zend_do_fetch_constant(A, B, C, ZEND_RT, 0 TSRMLS_CC); } class_constant(A) ::= variable_class_name(B) PAAMAYIM_NEKUDOTAYIM STRING(C). { zend_do_fetch_constant(A, B, C, ZEND_RT, 0 TSRMLS_CC); } -// Just to the build works -todo ::= OPEN_TAG OPEN_TAG_WITH_ECHO ENCAPSED_AND_WHITESPACE CURLY_OPEN VARIABLE - DOLLAR_OPEN_CURLY_BRACES WHITESPACE COMMENT CLOSE_TAG DOC_COMMENT - OBJECT_HINT INT_HINT LIST DOUBLE_ARROW VAR DEFAULT - DECLARE EMPTY NUM_STRING ENDFOREACH ENDDECLARE ENDWHILE - DO FOREACH FOR CASE CLASS ENDSWITCH ENDFOR IMPLEMENTS INTERFACE - TRY TRAIT INSTEADOF OBJECT_OPERATOR GLOBAL STRING_HINT SWITCH SCALAR_HINT ARRAY - ISSET RESOURCE_HINT DOUBLE_HINT BOOL_HINT NUMERIC_HINT. - /* * Local variables: * tab-width: 4 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/LEMON/Zend/ zend_language_parser.y
colder Fri, 09 Jul 2010 11:24:52 + Revision: http://svn.php.net/viewvc?view=revisionrevision=301117 Log: Woops Changed paths: U php/php-src/branches/LEMON/Zend/zend_language_parser.y Modified: php/php-src/branches/LEMON/Zend/zend_language_parser.y === --- php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 11:24:11 UTC (rev 301116) +++ php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 11:24:52 UTC (rev 301117) @@ -242,7 +242,7 @@ //; statement ::= unticked_statement. { zend_do_ticks(TSRMLS_C); } -statement ::= STRING(B) COLON. { zend_do_label(A TSRMLS_CC); } +statement ::= STRING(B) COLON. { zend_do_label(B TSRMLS_CC); } //unticked_statement: // LBRACE inner_statement_list RBRACE -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/LEMON/Zend/ zend_language_parser.y
colder Fri, 09 Jul 2010 11:25:59 + Revision: http://svn.php.net/viewvc?view=revisionrevision=301118 Log: Fix irreducible rule Changed paths: U php/php-src/branches/LEMON/Zend/zend_language_parser.y Modified: php/php-src/branches/LEMON/Zend/zend_language_parser.y === --- php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 11:24:52 UTC (rev 301117) +++ php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 11:25:59 UTC (rev 301118) @@ -1568,7 +1568,6 @@ // reference_variable(A) ::= reference_variable(B) LBRACKET dim_offset(C) RBRACKET. { fetch_array_dim(A, B, C TSRMLS_CC); } -reference_variable(A) ::= reference_variable(B) LBRACKET dim_offset(C) RBRACKET. { fetch_array_dim(A, B, C TSRMLS_CC); } reference_variable(A) ::= reference_variable(B) LBRACE expr(C) RBRACE. { fetch_string_offset(A, B, C TSRMLS_CC); } reference_variable(A) ::= compound_variable(B).{ zend_do_begin_variable_parse(TSRMLS_C); fetch_simple_variable(A, B, 1 TSRMLS_CC); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/LEMON/Zend/ zend_language_parser.y
colder Fri, 09 Jul 2010 11:39:27 + Revision: http://svn.php.net/viewvc?view=revisionrevision=301120 Log: guard tsrm inside a ifdef, remains to specify it at the time of the lemon call Changed paths: U php/php-src/branches/LEMON/Zend/zend_language_parser.y Modified: php/php-src/branches/LEMON/Zend/zend_language_parser.y === --- php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 11:28:40 UTC (rev 301119) +++ php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 11:39:27 UTC (rev 301120) @@ -46,7 +46,9 @@ %token_type {znode} -%extra_argument {void ***tsrm_ls} +%ifdef ZTS +%extra_argument {void ***tsrm_ls} +%endif %type function_call_ns_i {znode_array} %type function_call_ns_ii {znode_array} @@ -78,7 +80,6 @@ /* TOKENS TRANSLATION: - , = T_COMMA = = T_EQUAL ( = T_LPAREN -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/LEMON/Zend/ zend_language_parser.y
colder Fri, 09 Jul 2010 11:43:27 + Revision: http://svn.php.net/viewvc?view=revisionrevision=301121 Log: fix array Changed paths: U php/php-src/branches/LEMON/Zend/zend_language_parser.y Modified: php/php-src/branches/LEMON/Zend/zend_language_parser.y === --- php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 11:39:27 UTC (rev 301120) +++ php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 11:43:27 UTC (rev 301121) @@ -1411,8 +1411,8 @@ // | static_scalar { $$.op_type = IS_CONST; INIT_PZVAL($$.u.constant); array_init($$.u.constant); zend_do_add_static_array_element($$, NULL, $1); } //; -non_empty_static_array_pair_list(A) ::= non_empty_static_array_pair_list COMMA static_scalar(B) DOUBLE_ARROW static_scalar(C). { zend_do_add_static_array_element(A, B, C); } -non_empty_static_array_pair_list(A) ::= non_empty_static_array_pair_list COMMA static_scalar(B). { zend_do_add_static_array_element(A, NULL, B); } +non_empty_static_array_pair_list(A) ::= non_empty_static_array_pair_list(B) COMMA static_scalar(C) DOUBLE_ARROW static_scalar(D). { zend_do_add_static_array_element(B, C, D); A = B; } +non_empty_static_array_pair_list(A) ::= non_empty_static_array_pair_list(B) COMMA static_scalar(C). { zend_do_add_static_array_element(B, NULL, C); A = B; } non_empty_static_array_pair_list(A) ::= static_scalar(B) DOUBLE_ARROW static_scalar(C). { A.op_type = IS_CONST; INIT_PZVAL(A.u.constant); array_init(A.u.constant); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/LEMON/Zend/ Makefile.am
colder Fri, 09 Jul 2010 12:02:41 + Revision: http://svn.php.net/viewvc?view=revisionrevision=301122 Log: Allow conflicts Changed paths: U php/php-src/branches/LEMON/Zend/Makefile.am Modified: php/php-src/branches/LEMON/Zend/Makefile.am === --- php/php-src/branches/LEMON/Zend/Makefile.am 2010-07-09 11:43:27 UTC (rev 301121) +++ php/php-src/branches/LEMON/Zend/Makefile.am 2010-07-09 12:02:41 UTC (rev 301122) @@ -35,7 +35,7 @@ zend_language_parser.h: zend_language_parser.c zend_language_parser.c: $(srcdir)/zend_language_parser.y - $(LEMON) -q -c $(srcdir)/zend_language_parser.y + $(LEMON) -q -c $(srcdir)/zend_language_parser.y || test $? -eq 25 # INI parser/scanner rules -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/LEMON/ Makefile.frag
colder Fri, 09 Jul 2010 12:06:45 + Revision: http://svn.php.net/viewvc?view=revisionrevision=301123 Log: Allow conflicts Changed paths: U php/php-src/branches/LEMON/Makefile.frag Modified: php/php-src/branches/LEMON/Makefile.frag === --- php/php-src/branches/LEMON/Makefile.frag2010-07-09 12:02:41 UTC (rev 301122) +++ php/php-src/branches/LEMON/Makefile.frag2010-07-09 12:06:45 UTC (rev 301123) @@ -11,7 +11,7 @@ $(srcdir)/zend_language_parser.h: $(srcdir)/zend_language_parser.c $(srcdir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y - @$(LEMON) -q -c $(srcdir)/zend_language_parser.y + @$(LEMON) -q -c $(srcdir)/zend_language_parser.y || test $? -eq 25 $(srcdir)/zend_ini_parser.h: $(srcdir)/zend_ini_parser.c $(srcdir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/LEMON/ Makefile.frag Zend/Makefile.am
colder Fri, 09 Jul 2010 12:19:52 + Revision: http://svn.php.net/viewvc?view=revisionrevision=301124 Log: Fix exit code tests Changed paths: U php/php-src/branches/LEMON/Makefile.frag U php/php-src/branches/LEMON/Zend/Makefile.am Modified: php/php-src/branches/LEMON/Makefile.frag === --- php/php-src/branches/LEMON/Makefile.frag2010-07-09 12:06:45 UTC (rev 301123) +++ php/php-src/branches/LEMON/Makefile.frag2010-07-09 12:19:52 UTC (rev 301124) @@ -11,7 +11,7 @@ $(srcdir)/zend_language_parser.h: $(srcdir)/zend_language_parser.c $(srcdir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y - @$(LEMON) -q -c $(srcdir)/zend_language_parser.y || test $? -eq 25 + $(LEMON) -q -c $(srcdir)/zend_language_parser.y || test $$? -eq 25 $(srcdir)/zend_ini_parser.h: $(srcdir)/zend_ini_parser.c $(srcdir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y Modified: php/php-src/branches/LEMON/Zend/Makefile.am === --- php/php-src/branches/LEMON/Zend/Makefile.am 2010-07-09 12:06:45 UTC (rev 301123) +++ php/php-src/branches/LEMON/Zend/Makefile.am 2010-07-09 12:19:52 UTC (rev 301124) @@ -35,7 +35,7 @@ zend_language_parser.h: zend_language_parser.c zend_language_parser.c: $(srcdir)/zend_language_parser.y - $(LEMON) -q -c $(srcdir)/zend_language_parser.y || test $? -eq 25 + $(LEMON) -q -c $(srcdir)/zend_language_parser.y || test $$? -eq 25 # INI parser/scanner rules -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/LEMON/Zend/ zend_language_parser.y
colder Fri, 09 Jul 2010 12:30:15 + Revision: http://svn.php.net/viewvc?view=revisionrevision=301125 Log: Fix build without new productions Changed paths: U php/php-src/branches/LEMON/Zend/zend_language_parser.y Modified: php/php-src/branches/LEMON/Zend/zend_language_parser.y === --- php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 12:19:52 UTC (rev 301124) +++ php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 12:30:15 UTC (rev 301125) @@ -137,6 +137,10 @@ %right STATIC ABSTRACT FINAL PRIVATE PROTECTED PUBLIC. +// dummy tokens +%nonassoc OPEN_TAG OPEN_TAG_WITH_ECHO WHITESPACE COMMENT CLOSE_TAG DOC_COMMENT. + + //start: // top_statement_list { zend_do_end_compilation(TSRMLS_C); } //; @@ -316,6 +320,7 @@ unticked_statement ::= for_cont_2(B) for_statement. { zend_do_for_end(B TSRMLS_CC); } switch_i ::= SWITCH LPAREN expr(B) RPAREN. { zend_do_switch_cond(B TSRMLS_CC); } + unticked_statement ::= switch_i switch_case_list(B). { zend_do_switch_end(B TSRMLS_CC); } unticked_statement ::= LBRACE inner_statement_list RBRACE. @@ -1759,6 +1764,7 @@ class_constant(A) ::= class_name(B) PAAMAYIM_NEKUDOTAYIM STRING(C). { zend_do_fetch_constant(A, B, C, ZEND_RT, 0 TSRMLS_CC); } class_constant(A) ::= variable_class_name(B) PAAMAYIM_NEKUDOTAYIM STRING(C). { zend_do_fetch_constant(A, B, C, ZEND_RT, 0 TSRMLS_CC); } + /* * Local variables: * tab-width: 4 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/LEMON/Zend/ zend_language_parser.y
colder Fri, 09 Jul 2010 13:07:12 + Revision: http://svn.php.net/viewvc?view=revisionrevision=301126 Log: bailout on error Changed paths: U php/php-src/branches/LEMON/Zend/zend_language_parser.y Modified: php/php-src/branches/LEMON/Zend/zend_language_parser.y === --- php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 12:30:15 UTC (rev 301125) +++ php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-09 13:07:12 UTC (rev 301126) @@ -31,11 +31,12 @@ //%name lemon_ %syntax_error { - zend_error(E_PARSE, syntax error, unexpected '%.*s', LANG_SCNG(yy_leng), LANG_SCNG(yy_text)); +zend_error(E_PARSE, syntax error, unexpected '%.*s', LANG_SCNG(yy_leng), LANG_SCNG(yy_text)); +zend_bailout(); } %stack_overflow { - fprintf(stderr,Woops, parser stack overflow\n); +fprintf(stderr,Woops, parser stack overflow\n); } %stack_size 500 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/LEMON/ Zend/zend_language_parser.y lempar.c
colder Thu, 08 Jul 2010 09:36:54 + Revision: http://svn.php.net/viewvc?view=revisionrevision=301073 Log: move includes to the lemon definition file Changed paths: U php/php-src/branches/LEMON/Zend/zend_language_parser.y U php/php-src/branches/LEMON/lempar.c Modified: php/php-src/branches/LEMON/Zend/zend_language_parser.y === --- php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-08 09:32:44 UTC (rev 301072) +++ php/php-src/branches/LEMON/Zend/zend_language_parser.y 2010-07-08 09:36:54 UTC (rev 301073) @@ -1,3 +1,4 @@ +%include{ /* +--+ | Zend Engine | @@ -19,6 +20,16 @@ /* $Id$ */ +#include zend_compile.h +#include zend.h +#include zend_list.h +#include zend_globals.h +#include zend_API.h +#include zend_constants.h +} + + + /* TOKENS TRANSLATION: , = T_COMMA Modified: php/php-src/branches/LEMON/lempar.c === --- php/php-src/branches/LEMON/lempar.c 2010-07-08 09:32:44 UTC (rev 301072) +++ php/php-src/branches/LEMON/lempar.c 2010-07-08 09:36:54 UTC (rev 301073) @@ -4,12 +4,6 @@ /* First off, code is included that follows the include declaration ** in the input grammar file. */ #include stdio.h -#include zend_compile.h -#include zend.h -#include zend_list.h -#include zend_globals.h -#include zend_API.h -#include zend_constants.h %% /* Next is all token values, in a form suitable for use by makeheaders. ** This section will be null unless lemon is run with the -m switch. -- 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/NEWS branches/PHP_5_3/ext/spl/spl_iterators.c trunk/ext/spl/spl_iterators.c
colder Wed, 07 Jul 2010 21:55:17 + Revision: http://svn.php.net/viewvc?view=revisionrevision=301064 Log: Fixed #51697 (Unsafe operations in free_storage of SPL iterators, causes crashes during shutdown) Bug: http://bugs.php.net/51697 (Assigned) Segfault in spl_iterators.c Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/spl/spl_iterators.c U php/php-src/trunk/ext/spl/spl_iterators.c Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2010-07-07 20:03:04 UTC (rev 301063) +++ php/php-src/branches/PHP_5_3/NEWS 2010-07-07 21:55:17 UTC (rev 301064) @@ -7,6 +7,8 @@ results and PHP crashes). (Felipe) - Fixed bug #52238 (Crash when an Exception occured in iterator_to_array). (Johannes) +- Fixed bug #51697 (Unsafe operations in free_storage of SPL iterators, + causes crash during shutdown). (Etienne) 01 Jul 2010, PHP 5.3.3 RC2 - Fixed SplObjectStorage unserialization problems (CVE-2010-2225). (Stas) Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_iterators.c === --- php/php-src/branches/PHP_5_3/ext/spl/spl_iterators.c 2010-07-07 20:03:04 UTC (rev 301063) +++ php/php-src/branches/PHP_5_3/ext/spl/spl_iterators.c 2010-07-07 21:55:17 UTC (rev 301064) @@ -131,7 +131,7 @@ spl_recursive_it_object *object = (spl_recursive_it_object*)_iter-data; zend_object_iterator *sub_iter; - while (object-level) { + while (object-level 0) { sub_iter = object-iterators[object-level].iterator; sub_iter-funcs-dtor(sub_iter TSRMLS_CC); zval_ptr_dtor(object-iterators[object-level--].zobject); @@ -139,10 +139,10 @@ object-iterators = erealloc(object-iterators, sizeof(spl_sub_iterator)); object-level = 0; - zval_ptr_dtor(iter-zobject); + zval_ptr_dtor(iter-zobject); efree(iter); } - + static int spl_recursive_it_valid_ex(spl_recursive_it_object *object, zval *zthis TSRMLS_DC) { zend_object_iterator *sub_iter; @@ -536,6 +536,18 @@ intern-iterators[0].state = RS_START; zend_restore_error_handling(error_handling TSRMLS_CC); + + if (EG(exception)) { + zend_object_iterator *sub_iter; + + while (intern-level = 0) { + sub_iter = intern-iterators[intern-level].iterator; + sub_iter-funcs-dtor(sub_iter TSRMLS_CC); + zval_ptr_dtor(intern-iterators[intern-level--].zobject); + } + efree(intern-iterators); + intern-iterators = NULL; + } } /* {{{ proto void RecursiveIteratorIterator::__construct(RecursiveIterator|IteratorAggregate it [, int mode = RIT_LEAVES_ONLY [, int flags = 0]]) throws InvalidArgumentException @@ -778,11 +790,14 @@ } /* {{{ spl_RecursiveIteratorIterator_dtor */ -static void spl_RecursiveIteratorIterator_free_storage(void *_object TSRMLS_DC) +static void spl_RecursiveIteratorIterator_dtor(zend_object *_object, zend_object_handle handle TSRMLS_DC) { spl_recursive_it_object *object = (spl_recursive_it_object *)_object; zend_object_iterator *sub_iter; + /* call standard dtor */ + zend_objects_destroy_object(_object, handle); + if (object-iterators) { while (object-level = 0) { sub_iter = object-iterators[object-level].iterator; @@ -792,7 +807,14 @@ efree(object-iterators); object-iterators = NULL; } +} +/* }}} */ +/* {{{ spl_RecursiveIteratorIterator_dtor */ +static void spl_RecursiveIteratorIterator_free_storage(void *_object TSRMLS_DC) +{ + spl_recursive_it_object *object = (spl_recursive_it_object *)_object; + zend_object_std_dtor(object-std TSRMLS_CC); smart_str_free(object-prefix[0]); smart_str_free(object-prefix[1]); @@ -827,7 +849,7 @@ zend_object_std_init(intern-std, class_type TSRMLS_CC); zend_hash_copy(intern-std.properties, class_type-default_properties, (copy_ctor_func_t) zval_add_ref, (void *) tmp, sizeof(zval *)); - retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) spl_RecursiveIteratorIterator_free_storage, NULL TSRMLS_CC); + retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)spl_RecursiveIteratorIterator_dtor, (zend_objects_free_object_storage_t) spl_RecursiveIteratorIterator_free_storage, NULL TSRMLS_CC); retval.handlers = spl_handlers_rec_it_it; return retval; } @@ -1909,17 +1931,27 @@ #endif -/* {{{ spl_dual_it_free_storage */ -static void spl_dual_it_free_storage(void *_object TSRMLS_DC) +/* {{{ spl_dual_it_dtor */ +static void spl_dual_it_dtor(zend_object *_object, zend_object_handle handle TSRMLS_DC) { spl_dual_it_object*object = (spl_dual_it_object *)_object; + /* call standard dtor */ + zend_objects_destroy_object(_object, handle); + spl_dual_it_free(object TSRMLS_CC); if (object-inner.iterator) { object-inner.iterator-funcs-dtor(object-inner.iterator TSRMLS_CC); } +} +/* }}} */ +/* {{{
[PHP-CVS] Re: [PHP-DEV] Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/Zend/tests/bug51421.phpt branches/PHP_5_2/Zend/zend_compile.c branches/PHP_5_3/Zend/tests/bug51421.phpt branches/PHP_5_3/Zen
Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Etienne Kneuss http://www.colder.ch
Re: [PHP-CVS] Re: [PHP-DEV] Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/Zend/tests/bug51421.phpt branches/PHP_5_2/Zend/zend_compile.c branches/PHP_5_3/Zend/tests/bug51421.phpt branches/PHP_5_3
Hi, On Mon, Jun 28, 2010 at 20:17, Stas Malyshev smalys...@sugarcrm.com wrote: Hi! 1) arguments can be gathered dynamically in the function, using func_get_args. For that reason, PHP gracefully allow a call with too many arguments. Isn't it the case today? It's the case at the time of the calls. But not when overriding a method: class A { public function foo($a) { } } class B extends A { public function foo() {} } is considered invalid, but $obj-foo($arg); would be perfectly valid for both objects. Maybe also we can add some syntax like: function foo($a, $b, ...) - where ... means I'll deal with those arguments myself, ignore any compatibility checks so if the prototype is foo($a,$b,$c) $a and $b would be checked but not $c and the function is considered to have enough args. I'd find that syntax pretty explicit and easy to understand, it wouldn't break any BC. 2) a child method should be allowed to define type hints in a contra-variant manner (currently, it's invariant) This needs to be fixed. 3) a child method should be allowed to return a ref even if the parent method is not defined to do so. (returning a ref is an additional constraint, and following co-variance of return values, it should be allowed). The basic example of this annoyance is: abstract class A implements ArrayAcces { public function__offsetGet($name) { ... } } This needs to be fixed too. 4) all in all: it shouldn't throw a fatal error, those are not critical situations for the engine. I'd say in general OO part of PHP seems to be much more strict and Java-like than the rest. I'm not sure it's good. I'd demote all situations where the engine has a way to proceed to at least warning level. I don't believe that any of those checks causes difficulty for the engine, especially considering that internal classes can pretty much to what they want anyway. I'd like to propose to relax such checks, by either allowing more (e.g. 1, 2 and 3) which can be painful and complicated, or simply removing those checks. I think we shouldn't remove them - we should fix them. It doesn't seem to be too hard, IMHO. Enforcing contra-variance can become a tad bit tricky when it comes to: 1) argument vs no argument 2) argument with/without null as default value 3) by ref or not (with/without default values) We should probably specify it formally in which case a prototype is accepted, and then see what needs to be fixed. Also, checking for subtyping in PHP is O(n) which is slow, but I don't believe it's a concern big enough to change the way we implement instanceof. Best, -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- Etienne Kneuss http://www.colder.ch
[PHP-CVS] svn: /php/php-src/trunk/ext/spl/ spl_observer.c
colder Mon, 10 May 2010 12:38:13 + Revision: http://svn.php.net/viewvc?view=revisionrevision=299213 Log: Fix crash Changed paths: U php/php-src/trunk/ext/spl/spl_observer.c Modified: php/php-src/trunk/ext/spl/spl_observer.c === --- php/php-src/trunk/ext/spl/spl_observer.c2010-05-10 11:50:57 UTC (rev 299212) +++ php/php-src/trunk/ext/spl/spl_observer.c2010-05-10 12:38:13 UTC (rev 299213) @@ -250,9 +250,10 @@ static zend_object_value spl_object_storage_new_ex(zend_class_entry *class_type, spl_SplObjectStorage **obj, zval *orig TSRMLS_DC) /* {{{ */ { - zend_object_value retval; + zend_object_value retval; spl_SplObjectStorage *intern; - zval *tmp; + zend_class_entry *parent = class_type; + zval *tmp; intern = emalloc(sizeof(spl_SplObjectStorage)); memset(intern, 0, sizeof(spl_SplObjectStorage)); @@ -271,11 +272,15 @@ spl_object_storage_addall(intern, orig, other TSRMLS_CC); } - - if (class_type != spl_ce_SplObjectStorage) { - zend_hash_find(class_type-function_table, gethash, sizeof(gethash),(void **) intern-fptr_get_hash); - if (intern-fptr_get_hash intern-fptr_get_hash-common.scope == spl_ce_SplObjectStorage) { - intern-fptr_get_hash = NULL; + while (parent) { + if (parent == spl_ce_SplObjectStorage) { + if (class_type != spl_ce_SplObjectStorage) { + zend_hash_find(class_type-function_table, gethash,sizeof(gethash),(void **) intern-fptr_get_hash); + if (intern-fptr_get_hash-common.scope == spl_ce_SplObjectStorage) { + intern-fptr_get_hash = NULL; + } + } + break; } } -- 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/spl/ spl_observer.c
colder Mon, 10 May 2010 13:03:33 + Revision: http://svn.php.net/viewvc?view=revisionrevision=299214 Log: fix the fix for the fix Changed paths: U php/php-src/trunk/ext/spl/spl_observer.c Modified: php/php-src/trunk/ext/spl/spl_observer.c === --- php/php-src/trunk/ext/spl/spl_observer.c2010-05-10 12:38:13 UTC (rev 299213) +++ php/php-src/trunk/ext/spl/spl_observer.c2010-05-10 13:03:33 UTC (rev 299214) @@ -282,6 +282,8 @@ } break; } + + parent = parent-parent; } return retval; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ NEWS ext/spl/spl_observer.c ext/spl/tests/SplObjectStorage_getHash.phpt
colder Thu, 29 Apr 2010 15:47:41 + Revision: http://svn.php.net/viewvc?view=revisionrevision=298780 Log: Implement SplObjectStorage::getHash() Changed paths: U php/php-src/trunk/NEWS U php/php-src/trunk/ext/spl/spl_observer.c A php/php-src/trunk/ext/spl/tests/SplObjectStorage_getHash.phpt Modified: php/php-src/trunk/NEWS === --- php/php-src/trunk/NEWS 2010-04-29 15:17:44 UTC (rev 298779) +++ php/php-src/trunk/NEWS 2010-04-29 15:47:41 UTC (rev 298780) @@ -26,6 +26,7 @@ - Added ReflectionZendExtension class. (Johannes) - Added command line option --rz to CLI. (Johannes) - Added closure $this support back. (Stas) +- Added SplObjectStorage::getHash() hook. (Etienne) - default_charset if not specified is now UTF-8 instead of ISO-8859-1. (Rasmus) Modified: php/php-src/trunk/ext/spl/spl_observer.c === --- php/php-src/trunk/ext/spl/spl_observer.c 2010-04-29 15:17:44 UTC (rev 298779) +++ php/php-src/trunk/ext/spl/spl_observer.c 2010-04-29 15:47:41 UTC (rev 298780) @@ -84,6 +84,7 @@ long index; HashPosition pos; long flags; + zend_function*fptr_get_hash; HashTable*debug_info; } spl_SplObjectStorage; /* }}} */ @@ -109,36 +110,96 @@ efree(object); } /* }}} */ +static char *spl_object_storage_get_hash(spl_SplObjectStorage *intern, zval *this, zval *obj, int *hash_len_ptr TSRMLS_DC) { + if (intern-fptr_get_hash) { + zval *rv; + zend_call_method_with_1_params(this, intern-std.ce, intern-fptr_get_hash, getHash, rv, obj); + if (rv) { + if (Z_TYPE_P(rv) == IS_STRING) { +int hash_len = Z_STRLEN_P(rv); +char *hash = emalloc((hash_len+1)*sizeof(char *)); +strncpy(hash, Z_STRVAL_P(rv), hash_len); +hash[hash_len] = 0; + +zval_ptr_dtor(rv); +if (hash_len_ptr) { + *hash_len_ptr = hash_len; +} +return hash; + } else { +zend_throw_exception(spl_ce_RuntimeException, Hash needs to be a string, 0 TSRMLS_CC); + +zval_ptr_dtor(rv); +return NULL; + } + } else { + return NULL; + } + } else { + int hash_len = sizeof(zend_object_value); + +#if HAVE_PACKED_OBJECT_VALUE + return (char*)Z_OBJVAL_P(obj); +#else + char *hash = emalloc((hash_len+1)*sizeof(char *)); + + zend_object_value zvalue; + memset(zvalue, 0, sizeof(zend_object_value)); + zvalue.handle = Z_OBJ_HANDLE_P(obj); + zvalue.handlers = Z_OBJ_HT_P(obj); + + strncpy(hash, (char *)zvalue, hash_len); + hash[hash_len] = 0; +#endif + + if (hash_len_ptr) { + *hash_len_ptr = hash_len; + } + + return hash; + } +} + +static void spl_object_storage_free_hash(spl_SplObjectStorage *intern, char *hash) { + if (intern-fptr_get_hash) { + efree(hash); + } else { +#if HAVE_PACKED_OBJECT_VALUE + // Nothing to do +#else + efree(hash); +#endif + } +} + static void spl_object_storage_dtor(spl_SplObjectStorageElement *element) /* {{{ */ { zval_ptr_dtor(element-obj); zval_ptr_dtor(element-inf); } /* }}} */ -spl_SplObjectStorageElement* spl_object_storage_get(spl_SplObjectStorage *intern, zval *obj TSRMLS_DC) /* {{{ */ +spl_SplObjectStorageElement* spl_object_storage_get(spl_SplObjectStorage *intern, char *hash, int hash_len TSRMLS_DC) /* {{{ */ { spl_SplObjectStorageElement *element; - zend_object_value *pzvalue; -#if HAVE_PACKED_OBJECT_VALUE - pzvalue = Z_OBJVAL_P(obj); -#else - zend_object_value zvalue; - memset(zvalue, 0, sizeof(zend_object_value)); - zvalue.handle = Z_OBJ_HANDLE_P(obj); - zvalue.handlers = Z_OBJ_HT_P(obj); - pzvalue = zvalue; -#endif - if (zend_hash_find(intern-storage, (char*)pzvalue, sizeof(zend_object_value), (void**)element) == SUCCESS) { + if (zend_hash_find(intern-storage, hash, hash_len, (void**)element) == SUCCESS) { return element; } else { return NULL; } } /* }}} */ -void spl_object_storage_attach(spl_SplObjectStorage *intern, zval *obj, zval *inf TSRMLS_DC) /* {{{ */ +void spl_object_storage_attach(spl_SplObjectStorage *intern, zval *this, zval *obj, zval *inf TSRMLS_DC) /* {{{ */ { spl_SplObjectStorageElement *pelement, element; - pelement = spl_object_storage_get(intern, obj TSRMLS_CC); + + int hash_len; + char *hash = spl_object_storage_get_hash(intern, this, obj, hash_len TSRMLS_CC); + if (!hash) { + return; + } + + pelement = spl_object_storage_get(intern, hash, hash_len TSRMLS_CC); + if (inf) { Z_ADDREF_P(inf); } else { @@ -147,46 +208,34 @@ if (pelement) { zval_ptr_dtor(pelement-inf); pelement-inf = inf; + spl_object_storage_free_hash(intern, hash); return; } Z_ADDREF_P(obj); element.obj = obj; element.inf = inf; -#if HAVE_PACKED_OBJECT_VALUE - zend_hash_update(intern-storage, (char*)Z_OBJVAL_P(obj), sizeof(zend_object_value), element, sizeof(spl_SplObjectStorageElement), NULL); -#else - { - zend_object_value zvalue; - memset(zvalue, 0, sizeof(zend_object_value)); - zvalue.handle =
[PHP-CVS] svn: /php/php-src/trunk/ext/spl/ spl_observer.c
colder Thu, 29 Apr 2010 17:14:37 + Revision: http://svn.php.net/viewvc?view=revisionrevision=298782 Log: Fix misplaced code Changed paths: U php/php-src/trunk/ext/spl/spl_observer.c Modified: php/php-src/trunk/ext/spl/spl_observer.c === --- php/php-src/trunk/ext/spl/spl_observer.c2010-04-29 15:49:51 UTC (rev 298781) +++ php/php-src/trunk/ext/spl/spl_observer.c2010-04-29 17:14:37 UTC (rev 298782) @@ -139,6 +139,11 @@ int hash_len = sizeof(zend_object_value); #if HAVE_PACKED_OBJECT_VALUE + + if (hash_len_ptr) { + *hash_len_ptr = hash_len; + } + return (char*)Z_OBJVAL_P(obj); #else char *hash = emalloc((hash_len+1)*sizeof(char *)); @@ -150,13 +155,13 @@ strncpy(hash, (char *)zvalue, hash_len); hash[hash_len] = 0; -#endif if (hash_len_ptr) { *hash_len_ptr = hash_len; } - + return hash; +#endif } } -- 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/NEWS branches/PHP_5_3/ext/spl/spl_directory.c branches/PHP_5_3/ext/spl/tests/bug48361.phpt trunk/ext/spl/spl_directory.c trunk/ext/spl/tests/bug48361.phpt
colder Tue, 27 Apr 2010 08:56:01 + Revision: http://svn.php.net/viewvc?view=revisionrevision=298647 Log: Fixed #48361 (SplFileInfo::getPathName() should return the parent Bug: http://bugs.php.net/48361 (Assigned) SplFileInfo::getPathinfo no returning info of path Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c A php/php-src/branches/PHP_5_3/ext/spl/tests/bug48361.phpt U php/php-src/trunk/ext/spl/spl_directory.c A php/php-src/trunk/ext/spl/tests/bug48361.phpt Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2010-04-27 08:45:23 UTC (rev 298646) +++ php/php-src/branches/PHP_5_3/NEWS 2010-04-27 08:56:01 UTC (rev 298647) @@ -106,6 +106,8 @@ - Fixed bug #48983 (DomDocument : saveHTMLFile wrong charset). (Rob) - Fixed bug #48902 (Timezone database fallback map is outdated). (Derick) - Fixed bug #48781 (Cyclical garbage collector memory leak). (Dmitry) +- Fixed bug #48361 (SplFileInfo::getPathInfo should return the + parent dir). (Etienne) - Fixed bug #46111 (Some timezone identifiers can not be parsed). (Derick) - Fixed bug #35673 (formatOutput does not work with saveHTML). (Rob) Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c === --- php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c2010-04-27 08:45:23 UTC (rev 298646) +++ php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c2010-04-27 08:56:01 UTC (rev 298647) @@ -1187,7 +1187,10 @@ int path_len; char *path = spl_filesystem_object_get_pathname(intern, path_len TSRMLS_CC); if (path) { - spl_filesystem_object_create_info(intern, path, path_len, 1, ce, return_value TSRMLS_CC); + char *dpath = estrndup(path, path_len); + path_len = php_dirname(dpath, path_len); + spl_filesystem_object_create_info(intern, dpath, path_len, 1, ce, return_value TSRMLS_CC); + efree(dpath); } } Added: php/php-src/branches/PHP_5_3/ext/spl/tests/bug48361.phpt === --- php/php-src/branches/PHP_5_3/ext/spl/tests/bug48361.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/spl/tests/bug48361.phpt2010-04-27 08:56:01 UTC (rev 298647) @@ -0,0 +1,14 @@ +--TEST-- +SPL: Bug #48361 SpleFileInfo::getPathName should return the dirname's path +--FILE-- +?php +$info = new SplFileInfo(__FILE__); +var_dump($info-getRealPath()); +var_dump($info-getPathInfo()-getRealPath()); +? +===DONE=== +--EXPECTF-- +string(%d) %stests%sbug48361.php +string(%d) %stests +===DONE=== + Modified: php/php-src/trunk/ext/spl/spl_directory.c === --- php/php-src/trunk/ext/spl/spl_directory.c 2010-04-27 08:45:23 UTC (rev 298646) +++ php/php-src/trunk/ext/spl/spl_directory.c 2010-04-27 08:56:01 UTC (rev 298647) @@ -1187,7 +1187,10 @@ int path_len; char *path = spl_filesystem_object_get_pathname(intern, path_len TSRMLS_CC); if (path) { - spl_filesystem_object_create_info(intern, path, path_len, 1, ce, return_value TSRMLS_CC); + char *dpath = estrndup(path, path_len); + path_len = php_dirname(dpath, path_len); + spl_filesystem_object_create_info(intern, dpath, path_len, 1, ce, return_value TSRMLS_CC); + efree(dpath); } } Added: php/php-src/trunk/ext/spl/tests/bug48361.phpt === --- php/php-src/trunk/ext/spl/tests/bug48361.phpt (rev 0) +++ php/php-src/trunk/ext/spl/tests/bug48361.phpt 2010-04-27 08:56:01 UTC (rev 298647) @@ -0,0 +1,14 @@ +--TEST-- +SPL: Bug #48361 SpleFileInfo::getPathName should return the dirname's path +--FILE-- +?php +$info = new SplFileInfo(__FILE__); +var_dump($info-getRealPath()); +var_dump($info-getPathInfo()-getRealPath()); +? +===DONE=== +--EXPECTF-- +string(%d) %stests%sbug48361.php +string(%d) %stests +===DONE=== + -- 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/spl/spl_iterators.c branches/PHP_5_2/ext/spl/tests/bug49723.phpt branches/PHP_5_3/ext/spl/spl_iterators.c branches/PHP_5_3/ext/spl/tests/bug49723.phpt
colder Tue, 27 Apr 2010 04:57:48 + Revision: http://svn.php.net/viewvc?view=revisionrevision=298633 Log: Fix #49723 (Skip seek when unnecessary) Bug: http://bugs.php.net/49723 (Assigned) LimitIterator with empty ArrayIterator Changed paths: U php/php-src/branches/PHP_5_2/ext/spl/spl_iterators.c A php/php-src/branches/PHP_5_2/ext/spl/tests/bug49723.phpt U php/php-src/branches/PHP_5_3/ext/spl/spl_iterators.c A php/php-src/branches/PHP_5_3/ext/spl/tests/bug49723.phpt U php/php-src/trunk/ext/spl/spl_iterators.c A php/php-src/trunk/ext/spl/tests/bug49723.phpt Modified: php/php-src/branches/PHP_5_2/ext/spl/spl_iterators.c === --- php/php-src/branches/PHP_5_2/ext/spl/spl_iterators.c2010-04-27 01:33:35 UTC (rev 298632) +++ php/php-src/branches/PHP_5_2/ext/spl/spl_iterators.c2010-04-27 04:57:48 UTC (rev 298633) @@ -1738,7 +1738,7 @@ zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, Cannot seek to %ld which is behind offset %ld plus count %ld, pos, intern-u.limit.offset, intern-u.limit.count); return; } - if (instanceof_function(intern-inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) { + if (pos != intern-current.pos instanceof_function(intern-inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) { MAKE_STD_ZVAL(zpos); ZVAL_LONG(zpos, pos); spl_dual_it_free(intern TSRMLS_CC); Added: php/php-src/branches/PHP_5_2/ext/spl/tests/bug49723.phpt === --- php/php-src/branches/PHP_5_2/ext/spl/tests/bug49723.phpt (rev 0) +++ php/php-src/branches/PHP_5_2/ext/spl/tests/bug49723.phpt2010-04-27 04:57:48 UTC (rev 298633) @@ -0,0 +1,16 @@ +--TEST-- +LimitIterator: do not seek if not needed +--FILE-- +?php + +$it = new ArrayIterator(array()); + +$lit = new LimitIterator($it, 0, 5); + +foreach ($lit as $v) { +echo $v; +} +? +===DONE=== +--EXPECT-- +===DONE=== Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_iterators.c === --- php/php-src/branches/PHP_5_3/ext/spl/spl_iterators.c2010-04-27 01:33:35 UTC (rev 298632) +++ php/php-src/branches/PHP_5_3/ext/spl/spl_iterators.c2010-04-27 04:57:48 UTC (rev 298633) @@ -2080,7 +2080,7 @@ zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, Cannot seek to %ld which is behind offset %ld plus count %ld, pos, intern-u.limit.offset, intern-u.limit.count); return; } - if (instanceof_function(intern-inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) { + if (pos != intern-current.pos instanceof_function(intern-inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) { MAKE_STD_ZVAL(zpos); ZVAL_LONG(zpos, pos); spl_dual_it_free(intern TSRMLS_CC); Added: php/php-src/branches/PHP_5_3/ext/spl/tests/bug49723.phpt === --- php/php-src/branches/PHP_5_3/ext/spl/tests/bug49723.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/spl/tests/bug49723.phpt2010-04-27 04:57:48 UTC (rev 298633) @@ -0,0 +1,16 @@ +--TEST-- +LimitIterator: do not seek if not needed +--FILE-- +?php + +$it = new ArrayIterator(array()); + +$lit = new LimitIterator($it, 0, 5); + +foreach ($lit as $v) { +echo $v; +} +? +===DONE=== +--EXPECT-- +===DONE=== Modified: php/php-src/trunk/ext/spl/spl_iterators.c === --- php/php-src/trunk/ext/spl/spl_iterators.c 2010-04-27 01:33:35 UTC (rev 298632) +++ php/php-src/trunk/ext/spl/spl_iterators.c 2010-04-27 04:57:48 UTC (rev 298633) @@ -2080,7 +2080,7 @@ zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, Cannot seek to %ld which is behind offset %ld plus count %ld, pos, intern-u.limit.offset, intern-u.limit.count); return; } - if (instanceof_function(intern-inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) { + if (pos != intern-current.pos instanceof_function(intern-inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) { MAKE_STD_ZVAL(zpos); ZVAL_LONG(zpos, pos); spl_dual_it_free(intern TSRMLS_CC); Added: php/php-src/trunk/ext/spl/tests/bug49723.phpt === --- php/php-src/trunk/ext/spl/tests/bug49723.phpt (rev 0) +++ php/php-src/trunk/ext/spl/tests/bug49723.phpt 2010-04-27 04:57:48 UTC (rev 298633) @@ -0,0 +1,16 @@ +--TEST-- +LimitIterator: do not seek if not needed +--FILE-- +?php + +$it = new ArrayIterator(array()); + +$lit = new LimitIterator($it, 0, 5); + +foreach ($lit as
[PHP-CVS] svn: /php/php-src/branches/PHP_5_2/ NEWS
colder Tue, 27 Apr 2010 04:58:44 + Revision: http://svn.php.net/viewvc?view=revisionrevision=298634 Log: Fix #49723 (Skip seek when unnecessary) Bug: http://bugs.php.net/49723 (Assigned) LimitIterator with empty ArrayIterator Changed paths: U php/php-src/branches/PHP_5_2/NEWS Modified: php/php-src/branches/PHP_5_2/NEWS === --- php/php-src/branches/PHP_5_2/NEWS 2010-04-27 04:57:48 UTC (rev 298633) +++ php/php-src/branches/PHP_5_2/NEWS 2010-04-27 04:58:44 UTC (rev 298634) @@ -52,6 +52,7 @@ (Raphael Geissert) - Fixed bug #50383 (Exceptions thrown in __call() / __callStatic() do not include file and line in trace). (Felipe) +- Fixed bug #49723 (LimitIterator with empty SeekableIterator). (Etienne) - Fixed bug #49576 (FILTER_VALIDATE_EMAIL filter needs updating) (Rasmus) - Fixed bug #49267 (Linking fails for iconv). (Moriyosh) - Fixed bug #43314 (iconv_mime_encode(), broken Q scheme). (Rasmus) -- 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/ NEWS ext/spl/spl_directory.c ext/spl/tests/bug51532.phpt
colder Tue, 27 Apr 2010 05:03:17 + Revision: http://svn.php.net/viewvc?view=revisionrevision=298635 Log: Merge fix for #51532 Bug: http://bugs.php.net/51532 (Closed) Cannot override SplFileObject::fscanf() Changed paths: U php/php-src/branches/PHP_5_2/NEWS U php/php-src/branches/PHP_5_2/ext/spl/spl_directory.c A php/php-src/branches/PHP_5_2/ext/spl/tests/bug51532.phpt Modified: php/php-src/branches/PHP_5_2/NEWS === --- php/php-src/branches/PHP_5_2/NEWS 2010-04-27 04:58:44 UTC (rev 298634) +++ php/php-src/branches/PHP_5_2/NEWS 2010-04-27 05:03:17 UTC (rev 298635) @@ -29,6 +29,7 @@ (Daniel Egeberg) - Fixed bug #51562 (query timeout in mssql can not be changed per query). (ejsmont dot artur at gmail dot com) +- Fixed bug #51532 (Wrong prototype for SplFileObject::fscanf()). (Etienne) - Fixed bug #51445 (var_dump() invalid/slow *RECURSION* detection). (Felipe) - Fixed bug #51393 (DateTime::createFromFormat() fails if format string contains timezone). (Adam) Modified: php/php-src/branches/PHP_5_2/ext/spl/spl_directory.c === --- php/php-src/branches/PHP_5_2/ext/spl/spl_directory.c2010-04-27 04:58:44 UTC (rev 298634) +++ php/php-src/branches/PHP_5_2/ext/spl/spl_directory.c2010-04-27 05:03:17 UTC (rev 298635) @@ -2264,9 +2264,8 @@ ZEND_END_ARG_INFO() static -ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 1, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 0, 0, 1) ZEND_ARG_INFO(0, format) - ZEND_ARG_INFO(1, ...) ZEND_END_ARG_INFO() static Added: php/php-src/branches/PHP_5_2/ext/spl/tests/bug51532.phpt === --- php/php-src/branches/PHP_5_2/ext/spl/tests/bug51532.phpt (rev 0) +++ php/php-src/branches/PHP_5_2/ext/spl/tests/bug51532.phpt2010-04-27 05:03:17 UTC (rev 298635) @@ -0,0 +1,14 @@ +--TEST-- +SPL: Allow valid extension of SplFileObject::fscanf +--FILE-- +?php + +class A extends SplFileObject { +public function fscanf($format) { + +} +} +? +===DONE=== +--EXPECT-- +===DONE=== -- 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/NEWS branches/PHP_5_2/ext/spl/spl_directory.c branches/PHP_5_2/ext/spl/tests/bug51374.phpt branches/PHP_5_3/ext/spl/spl_directory.c branches/PHP_5_3/ext/s
colder Tue, 27 Apr 2010 05:58:39 + Revision: http://svn.php.net/viewvc?view=revisionrevision=298638 Log: Fix #51374 (Wrongly initialized object properties) Bug: http://bugs.php.net/51374 (Open) initialized empty arrays in SPLFileObject subclasses fails Changed paths: U php/php-src/branches/PHP_5_2/NEWS U php/php-src/branches/PHP_5_2/ext/spl/spl_directory.c A php/php-src/branches/PHP_5_2/ext/spl/tests/bug51374.phpt U php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c A php/php-src/branches/PHP_5_3/ext/spl/tests/bug51374.phpt U php/php-src/trunk/ext/spl/spl_directory.c A php/php-src/trunk/ext/spl/tests/bug51374.phpt Modified: php/php-src/branches/PHP_5_2/NEWS === --- php/php-src/branches/PHP_5_2/NEWS 2010-04-27 05:56:56 UTC (rev 298637) +++ php/php-src/branches/PHP_5_2/NEWS 2010-04-27 05:58:39 UTC (rev 298638) @@ -35,6 +35,7 @@ - Fixed bug #51445 (var_dump() invalid/slow *RECURSION* detection). (Felipe) - Fixed bug #51393 (DateTime::createFromFormat() fails if format string contains timezone). (Adam) +- Fixed bug #51374 (Wrongly initialized object properties). (Etienne) - Fixed bug #51338 (URL-Rewriter is still enabled if use_only_cookies is on). (Ilia, j dot jeising at gmail dot com) - Fixed bug #51269 (zlib.output_compression Overwrites Vary Header). (Adam) Modified: php/php-src/branches/PHP_5_2/ext/spl/spl_directory.c === --- php/php-src/branches/PHP_5_2/ext/spl/spl_directory.c2010-04-27 05:56:56 UTC (rev 298637) +++ php/php-src/branches/PHP_5_2/ext/spl/spl_directory.c2010-04-27 05:58:39 UTC (rev 298638) @@ -341,6 +341,9 @@ php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); ce = ce ? ce : source-info_class; + + zend_update_class_constants(ce TSRMLS_CC); + return_value-value.obj = spl_filesystem_object_new_ex(ce, intern TSRMLS_CC); Z_TYPE_P(return_value) = IS_OBJECT; @@ -381,6 +384,9 @@ switch (type) { case SPL_FS_INFO: ce = ce ? ce : source-info_class; + + zend_update_class_constants(ce TSRMLS_CC); + return_value-value.obj = spl_filesystem_object_new_ex(ce, intern TSRMLS_CC); Z_TYPE_P(return_value) = IS_OBJECT; @@ -399,6 +405,9 @@ break; case SPL_FS_FILE: ce = ce ? ce : source-file_class; + + zend_update_class_constants(ce TSRMLS_CC); + return_value-value.obj = spl_filesystem_object_new_ex(ce, intern TSRMLS_CC); Z_TYPE_P(return_value) = IS_OBJECT; Added: php/php-src/branches/PHP_5_2/ext/spl/tests/bug51374.phpt === --- php/php-src/branches/PHP_5_2/ext/spl/tests/bug51374.phpt (rev 0) +++ php/php-src/branches/PHP_5_2/ext/spl/tests/bug51374.phpt2010-04-27 05:58:39 UTC (rev 298638) @@ -0,0 +1,19 @@ +--TEST-- +SPL: SplFileObject wrongly initializes objects +--FILE-- +?php +class Foo extends SplFileObject +{ +public $bam = array(); +} +$fileInfo = new SplFileInfo('php://temp'); +$fileInfo-setFileClass('Foo'); +$file = $fileInfo-openFile('r'); + +print var_dump($file-bam); // is null or UNKNOWN:0 +? +===DONE=== +--EXPECT-- +array(0) { +} +===DONE=== Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c === --- php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c2010-04-27 05:56:56 UTC (rev 298637) +++ php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c2010-04-27 05:58:39 UTC (rev 298638) @@ -397,6 +397,9 @@ zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, error_handling TSRMLS_CC); ce = ce ? ce : source-info_class; + + zend_update_class_constants(ce TSRMLS_CC); + return_value-value.obj = spl_filesystem_object_new_ex(ce, intern TSRMLS_CC); Z_TYPE_P(return_value) = IS_OBJECT; @@ -437,6 +440,9 @@ switch (type) { case SPL_FS_INFO: ce = ce ? ce : source-info_class; + + zend_update_class_constants(ce TSRMLS_CC); + return_value-value.obj = spl_filesystem_object_new_ex(ce, intern TSRMLS_CC); Z_TYPE_P(return_value) = IS_OBJECT; @@ -455,6 +461,9 @@ break; case SPL_FS_FILE: ce = ce ? ce : source-file_class; + + zend_update_class_constants(ce TSRMLS_CC); + return_value-value.obj = spl_filesystem_object_new_ex(ce, intern TSRMLS_CC); Z_TYPE_P(return_value) = IS_OBJECT; Added: php/php-src/branches/PHP_5_3/ext/spl/tests/bug51374.phpt === ---
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/spl/spl_directory.c branches/PHP_5_3/ext/spl/tests/bug51532.phpt trunk/ext/spl/spl_directory.c trunk/ext/spl/tests/bug51532.phpt
colder Sun, 25 Apr 2010 05:18:42 + Revision: http://svn.php.net/viewvc?view=revisionrevision=298475 Log: Fix #51532 (Invalid prototype for SplFileInfo::fscanf) Bug: http://bugs.php.net/51532 (Open) Cannot override SplFileObject::fscanf() Changed paths: U php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c A php/php-src/branches/PHP_5_3/ext/spl/tests/bug51532.phpt U php/php-src/trunk/ext/spl/spl_directory.c A php/php-src/trunk/ext/spl/tests/bug51532.phpt Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c === --- php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c2010-04-25 04:59:14 UTC (rev 298474) +++ php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c2010-04-25 05:18:42 UTC (rev 298475) @@ -2567,9 +2567,8 @@ ZEND_ARG_INFO(0, allowable_tags) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 1, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 0, 0, 1) ZEND_ARG_INFO(0, format) - ZEND_ARG_INFO(1, ...) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fwrite, 0, 0, 1) Added: php/php-src/branches/PHP_5_3/ext/spl/tests/bug51532.phpt === --- php/php-src/branches/PHP_5_3/ext/spl/tests/bug51532.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/spl/tests/bug51532.phpt2010-04-25 05:18:42 UTC (rev 298475) @@ -0,0 +1,14 @@ +--TEST-- +SPL: Allow valid extension of SplFileObject::fscanf +--FILE-- +?php + +class A extends SplFileObject { +public function fscanf($format) { + +} +} +? +===DONE=== +--EXPECT-- +===DONE=== Modified: php/php-src/trunk/ext/spl/spl_directory.c === --- php/php-src/trunk/ext/spl/spl_directory.c 2010-04-25 04:59:14 UTC (rev 298474) +++ php/php-src/trunk/ext/spl/spl_directory.c 2010-04-25 05:18:42 UTC (rev 298475) @@ -2567,9 +2567,8 @@ ZEND_ARG_INFO(0, allowable_tags) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 1, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 0, 0, 1) ZEND_ARG_INFO(0, format) - ZEND_ARG_INFO(1, ...) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fwrite, 0, 0, 1) Added: php/php-src/trunk/ext/spl/tests/bug51532.phpt === --- php/php-src/trunk/ext/spl/tests/bug51532.phpt (rev 0) +++ php/php-src/trunk/ext/spl/tests/bug51532.phpt 2010-04-25 05:18:42 UTC (rev 298475) @@ -0,0 +1,14 @@ +--TEST-- +SPL: Allow valid extension of SplFileObject::fscanf +--FILE-- +?php + +class A extends SplFileObject { +public function fscanf($format) { + +} +} +? +===DONE=== +--EXPECT-- +===DONE=== -- 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/Zend/tests/bug48667_1.phpt branches/PHP_5_2/Zend/tests/bug48667_2.phpt branches/PHP_5_3/Zend/tests/bug48667_1.phpt branches/PHP_5_3/Zend/tests/bug48667_2.
colder Tue, 02 Feb 2010 13:08:11 + Revision: http://svn.php.net/viewvc?view=revisionrevision=294336 Log: Fix tests Changed paths: U php/php-src/branches/PHP_5_2/Zend/tests/bug48667_1.phpt U php/php-src/branches/PHP_5_2/Zend/tests/bug48667_2.phpt U php/php-src/branches/PHP_5_3/Zend/tests/bug48667_1.phpt U php/php-src/branches/PHP_5_3/Zend/tests/bug48667_2.phpt U php/php-src/trunk/Zend/tests/bug48667_1.phpt U php/php-src/trunk/Zend/tests/bug48667_2.phpt Modified: php/php-src/branches/PHP_5_2/Zend/tests/bug48667_1.phpt === --- php/php-src/branches/PHP_5_2/Zend/tests/bug48667_1.phpt 2010-02-02 12:50:21 UTC (rev 294335) +++ php/php-src/branches/PHP_5_2/Zend/tests/bug48667_1.phpt 2010-02-02 13:08:11 UTC (rev 294336) @@ -7,4 +7,4 @@ ? --EXPECTF-- -Fatal error: Class A cannot implement both IteratorAggregate and Iterator at the same time. in %s on line %d +Fatal error: Class A cannot implement both IteratorAggregate and Iterator at the same time in %s on line %d Modified: php/php-src/branches/PHP_5_2/Zend/tests/bug48667_2.phpt === --- php/php-src/branches/PHP_5_2/Zend/tests/bug48667_2.phpt 2010-02-02 12:50:21 UTC (rev 294335) +++ php/php-src/branches/PHP_5_2/Zend/tests/bug48667_2.phpt 2010-02-02 13:08:11 UTC (rev 294336) @@ -7,4 +7,4 @@ ? --EXPECTF-- -Fatal error: Class A cannot implement both Iterator and IteratorAggregate at the same time. in %s on line %d +Fatal error: Class A cannot implement both Iterator and IteratorAggregate at the same time in %s on line %d Modified: php/php-src/branches/PHP_5_3/Zend/tests/bug48667_1.phpt === --- php/php-src/branches/PHP_5_3/Zend/tests/bug48667_1.phpt 2010-02-02 12:50:21 UTC (rev 294335) +++ php/php-src/branches/PHP_5_3/Zend/tests/bug48667_1.phpt 2010-02-02 13:08:11 UTC (rev 294336) @@ -7,4 +7,4 @@ ? --EXPECTF-- -Fatal error: Class A cannot implement both IteratorAggregate and Iterator at the same time. in %s on line %d +Fatal error: Class A cannot implement both IteratorAggregate and Iterator at the same time in %s on line %d Modified: php/php-src/branches/PHP_5_3/Zend/tests/bug48667_2.phpt === --- php/php-src/branches/PHP_5_3/Zend/tests/bug48667_2.phpt 2010-02-02 12:50:21 UTC (rev 294335) +++ php/php-src/branches/PHP_5_3/Zend/tests/bug48667_2.phpt 2010-02-02 13:08:11 UTC (rev 294336) @@ -7,4 +7,4 @@ ? --EXPECTF-- -Fatal error: Class A cannot implement both Iterator and IteratorAggregate at the same time. in %s on line %d +Fatal error: Class A cannot implement both Iterator and IteratorAggregate at the same time in %s on line %d Modified: php/php-src/trunk/Zend/tests/bug48667_1.phpt === --- php/php-src/trunk/Zend/tests/bug48667_1.phpt2010-02-02 12:50:21 UTC (rev 294335) +++ php/php-src/trunk/Zend/tests/bug48667_1.phpt2010-02-02 13:08:11 UTC (rev 294336) @@ -7,4 +7,4 @@ ? --EXPECTF-- -Fatal error: Class A cannot implement both IteratorAggregate and Iterator at the same time. in %s on line %d +Fatal error: Class A cannot implement both IteratorAggregate and Iterator at the same time in %s on line %d Modified: php/php-src/trunk/Zend/tests/bug48667_2.phpt === --- php/php-src/trunk/Zend/tests/bug48667_2.phpt2010-02-02 12:50:21 UTC (rev 294335) +++ php/php-src/trunk/Zend/tests/bug48667_2.phpt2010-02-02 13:08:11 UTC (rev 294336) @@ -7,4 +7,4 @@ ? --EXPECTF-- -Fatal error: Class A cannot implement both Iterator and IteratorAggregate at the same time. in %s on line %d +Fatal error: Class A cannot implement both Iterator and IteratorAggregate at the same time in %s on line %d -- 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/NEWS branches/PHP_5_2/Zend/tests/bug48667_1.phpt branches/PHP_5_2/Zend/tests/bug48667_2.phpt branches/PHP_5_2/Zend/zend_interfaces.c branches/PHP_5_3/Zend
colder Mon, 01 Feb 2010 13:45:57 + Revision: http://svn.php.net/viewvc?view=revisionrevision=294304 Log: Fix #48667 (Implementing Iterator and IteratorAggregate is now restricted in both orders) Bug: http://bugs.php.net/48667 (Assigned) could not implement - NOT redefining functions Changed paths: U php/php-src/branches/PHP_5_2/NEWS A php/php-src/branches/PHP_5_2/Zend/tests/bug48667_1.phpt A php/php-src/branches/PHP_5_2/Zend/tests/bug48667_2.phpt U php/php-src/branches/PHP_5_2/Zend/zend_interfaces.c A php/php-src/branches/PHP_5_3/Zend/tests/bug48667_1.phpt A php/php-src/branches/PHP_5_3/Zend/tests/bug48667_2.phpt U php/php-src/branches/PHP_5_3/Zend/zend_interfaces.c A php/php-src/trunk/Zend/tests/bug48667_1.phpt A php/php-src/trunk/Zend/tests/bug48667_2.phpt U php/php-src/trunk/Zend/zend_interfaces.c Modified: php/php-src/branches/PHP_5_2/NEWS === --- php/php-src/branches/PHP_5_2/NEWS 2010-02-01 12:59:08 UTC (rev 294303) +++ php/php-src/branches/PHP_5_2/NEWS 2010-02-01 13:45:57 UTC (rev 294304) @@ -66,6 +66,7 @@ - Fixed bug #49851 (http wrapper breaks on 1024 char long headers). (Ilia) - Fixed bug #49600 (imageTTFText text shifted right). (Takeshi Abe) - Fixed bug #49463 (setAttributeNS fails setting default namespace). (Rob) +- Fixed bug #48667 (Implementing Iterator and IteratorAggregate). (Etienne) - Fixed bug #48590 (SoapClient does not honor max_redirects). (Sriram) - Fixed bug #48190 (Content-type parameter boundary is not case-insensitive in HTTP uploads). (Ilia) Added: php/php-src/branches/PHP_5_2/Zend/tests/bug48667_1.phpt === --- php/php-src/branches/PHP_5_2/Zend/tests/bug48667_1.phpt (rev 0) +++ php/php-src/branches/PHP_5_2/Zend/tests/bug48667_1.phpt 2010-02-01 13:45:57 UTC (rev 294304) @@ -0,0 +1,10 @@ +--TEST-- +Bug #48667 (Implementing both iterator and iteratoraggregate) +--FILE-- +?php + +abstract class A implements Iterator, IteratorAggregate { } + +? +--EXPECTF-- +Fatal error: Class A cannot implement both IteratorAggregate and Iterator at the same time. in %s on line %d Added: php/php-src/branches/PHP_5_2/Zend/tests/bug48667_2.phpt === --- php/php-src/branches/PHP_5_2/Zend/tests/bug48667_2.phpt (rev 0) +++ php/php-src/branches/PHP_5_2/Zend/tests/bug48667_2.phpt 2010-02-01 13:45:57 UTC (rev 294304) @@ -0,0 +1,10 @@ +--TEST-- +Bug #48667 (Implementing both iterator and iteratoraggregate) +--FILE-- +?php + +abstract class A implements IteratorAggregate, Iterator { } + +? +--EXPECTF-- +Fatal error: Class A cannot implement both Iterator and IteratorAggregate at the same time. in %s on line %d Modified: php/php-src/branches/PHP_5_2/Zend/zend_interfaces.c === --- php/php-src/branches/PHP_5_2/Zend/zend_interfaces.c 2010-02-01 12:59:08 UTC (rev 294303) +++ php/php-src/branches/PHP_5_2/Zend/zend_interfaces.c 2010-02-01 13:45:57 UTC (rev 294304) @@ -344,6 +344,10 @@ if (class_type-num_interfaces) { for (i = 0; i class_type-num_interfaces; i++) { if (class_type-interfaces[i] == zend_ce_iterator) { + zend_error(E_ERROR, Class %s cannot implement both %s and %s at the same time., + class_type-name, + interface-name, + zend_ce_iterator-name); return FAILURE; } if (class_type-interfaces[i] == zend_ce_traversable) { @@ -369,8 +373,14 @@ if (class_type-type == ZEND_INTERNAL_CLASS) { /* inheritance ensures the class has the necessary userland methods */ return SUCCESS; - } else if (class_type-get_iterator != zend_user_it_get_new_iterator) { + } else { /* c-level get_iterator cannot be changed */ + if (class_type-get_iterator == zend_user_it_get_new_iterator) { +zend_error(E_ERROR, Class %s cannot implement both %s and %s at the same time., + class_type-name, + interface-name, + zend_ce_aggregate-name); + } return FAILURE; } } Added: php/php-src/branches/PHP_5_3/Zend/tests/bug48667_1.phpt === --- php/php-src/branches/PHP_5_3/Zend/tests/bug48667_1.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/Zend/tests/bug48667_1.phpt 2010-02-01 13:45:57 UTC (rev 294304) @@ -0,0 +1,10 @@ +--TEST-- +Bug #48667 (Implementing both iterator and iteratoraggregate) +--FILE-- +?php + +abstract class A implements Iterator, IteratorAggregate { } + +? +--EXPECTF-- +Fatal error: Class A cannot implement both IteratorAggregate and Iterator at the same time. in %s on line %d Added: php/php-src/branches/PHP_5_3/Zend/tests/bug48667_2.phpt === ---
Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_2/ NEWS
Crap, missed the section :) On Mon, Feb 1, 2010 at 2:54 PM, Jani Taskinen j...@php.net wrote: jani                   Mon, 01 Feb 2010 13:54:10 + Revision: http://svn.php.net/viewvc?view=revisionrevision=294305 Log: - Fix order. (this can not be so hard? :) Changed paths:   U  php/php-src/branches/PHP_5_2/NEWS Modified: php/php-src/branches/PHP_5_2/NEWS === --- php/php-src/branches/PHP_5_2/NEWS  2010-02-01 13:45:57 UTC (rev 294304) +++ php/php-src/branches/PHP_5_2/NEWS  2010-02-01 13:54:10 UTC (rev 294305) @@ -8,6 +8,7 @@  long). (Ilia)  - Fixed bug #50727 (Accesing mysqli-affected_rows on no connection causes  segfault). (Andrey, Johannes) +- Fixed bug #48667 (Implementing Iterator and IteratorAggregate). (Etienne)  28 Jan 2010, PHP 5.2.13RC1 @@ -66,7 +67,6 @@  - Fixed bug #49851 (http wrapper breaks on 1024 char long headers). (Ilia)  - Fixed bug #49600 (imageTTFText text shifted right). (Takeshi Abe)  - Fixed bug #49463 (setAttributeNS fails setting default namespace). (Rob) -- Fixed bug #48667 (Implementing Iterator and IteratorAggregate). (Etienne)  - Fixed bug #48590 (SoapClient does not honor max_redirects). (Sriram)  - Fixed bug #48190 (Content-type parameter boundary is not case-insensitive  in HTTP uploads). (Ilia) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Etienne Kneuss http://www.colder.ch -- 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/Zend/zend_interfaces.c branches/PHP_5_3/Zend/zend_interfaces.c trunk/Zend/zend_interfaces.c
colder Tue, 02 Feb 2010 04:49:02 + Revision: http://svn.php.net/viewvc?view=revisionrevision=294333 Log: Remove trailing dots Changed paths: U php/php-src/branches/PHP_5_2/Zend/zend_interfaces.c U php/php-src/branches/PHP_5_3/Zend/zend_interfaces.c U php/php-src/trunk/Zend/zend_interfaces.c Modified: php/php-src/branches/PHP_5_2/Zend/zend_interfaces.c === --- php/php-src/branches/PHP_5_2/Zend/zend_interfaces.c 2010-02-02 03:45:00 UTC (rev 294332) +++ php/php-src/branches/PHP_5_2/Zend/zend_interfaces.c 2010-02-02 04:49:02 UTC (rev 294333) @@ -344,7 +344,7 @@ if (class_type-num_interfaces) { for (i = 0; i class_type-num_interfaces; i++) { if (class_type-interfaces[i] == zend_ce_iterator) { - zend_error(E_ERROR, Class %s cannot implement both %s and %s at the same time., + zend_error(E_ERROR, Class %s cannot implement both %s and %s at the same time, class_type-name, interface-name, zend_ce_iterator-name); @@ -376,7 +376,7 @@ } else { /* c-level get_iterator cannot be changed */ if (class_type-get_iterator == zend_user_it_get_new_iterator) { - zend_error(E_ERROR, Class %s cannot implement both %s and %s at the same time., + zend_error(E_ERROR, Class %s cannot implement both %s and %s at the same time, class_type-name, interface-name, zend_ce_aggregate-name); Modified: php/php-src/branches/PHP_5_3/Zend/zend_interfaces.c === --- php/php-src/branches/PHP_5_3/Zend/zend_interfaces.c 2010-02-02 03:45:00 UTC (rev 294332) +++ php/php-src/branches/PHP_5_3/Zend/zend_interfaces.c 2010-02-02 04:49:02 UTC (rev 294333) @@ -353,7 +353,7 @@ if (class_type-num_interfaces) { for (i = 0; i class_type-num_interfaces; i++) { if (class_type-interfaces[i] == zend_ce_iterator) { - zend_error(E_ERROR, Class %s cannot implement both %s and %s at the same time., + zend_error(E_ERROR, Class %s cannot implement both %s and %s at the same time, class_type-name, interface-name, zend_ce_iterator-name); @@ -385,7 +385,7 @@ } else { /* c-level get_iterator cannot be changed */ if (class_type-get_iterator == zend_user_it_get_new_iterator) { - zend_error(E_ERROR, Class %s cannot implement both %s and %s at the same time., + zend_error(E_ERROR, Class %s cannot implement both %s and %s at the same time, class_type-name, interface-name, zend_ce_aggregate-name); Modified: php/php-src/trunk/Zend/zend_interfaces.c === --- php/php-src/trunk/Zend/zend_interfaces.c2010-02-02 03:45:00 UTC (rev 294332) +++ php/php-src/trunk/Zend/zend_interfaces.c2010-02-02 04:49:02 UTC (rev 294333) @@ -361,7 +361,7 @@ if (class_type-num_interfaces) { for (i = 0; i class_type-num_interfaces; i++) { if (class_type-interfaces[i] == zend_ce_iterator) { - zend_error(E_ERROR, Class %v cannot implement both %v and %v at the same time., + zend_error(E_ERROR, Class %v cannot implement both %v and %v at the same time, class_type-name, interface-name, zend_ce_iterator-name); @@ -393,7 +393,7 @@ } else {
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/ext/spl/spl_observer.c branches/PHP_5_3/ext/spl/spl_observer.c branches/PHP_5_3/ext/spl/tests/bug49263.phpt trunk/ext/spl/spl_observer.c trunk/ext/spl/tes
colder Tue, 06 Oct 2009 13:34:56 + Revision: http://svn.php.net/viewvc?view=revisionrevision=289250 Log: Fix bug #49263 (Offset error when unserializing self-references in SplObjectStorage) Bug: http://bugs.php.net/49263 (Assigned) SplObjectStorage fails to serialize references Changed paths: U php/php-src/branches/PHP_5_2/ext/spl/spl_observer.c U php/php-src/branches/PHP_5_3/ext/spl/spl_observer.c A php/php-src/branches/PHP_5_3/ext/spl/tests/bug49263.phpt U php/php-src/trunk/ext/spl/spl_observer.c A php/php-src/trunk/ext/spl/tests/bug49263.phpt Modified: php/php-src/branches/PHP_5_2/ext/spl/spl_observer.c === --- php/php-src/branches/PHP_5_2/ext/spl/spl_observer.c 2009-10-06 12:53:01 UTC (rev 289249) +++ php/php-src/branches/PHP_5_2/ext/spl/spl_observer.c 2009-10-06 13:34:56 UTC (rev 289250) @@ -348,7 +348,7 @@ ++p; ALLOC_INIT_ZVAL(pcount); - if (!php_var_unserialize(pcount, p, s + buf_len, var_hash TSRMLS_CC) || Z_TYPE_P(pcount) != IS_LONG) { + if (!php_var_unserialize(pcount, p, s + buf_len, NULL TSRMLS_CC) || Z_TYPE_P(pcount) != IS_LONG) { zval_ptr_dtor(pcount); goto outexcept; } Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_observer.c === --- php/php-src/branches/PHP_5_3/ext/spl/spl_observer.c 2009-10-06 12:53:01 UTC (rev 289249) +++ php/php-src/branches/PHP_5_3/ext/spl/spl_observer.c 2009-10-06 13:34:56 UTC (rev 289250) @@ -622,7 +622,7 @@ ++p; ALLOC_INIT_ZVAL(pcount); - if (!php_var_unserialize(pcount, p, s + buf_len, var_hash TSRMLS_CC) || Z_TYPE_P(pcount) != IS_LONG) { + if (!php_var_unserialize(pcount, p, s + buf_len, NULL TSRMLS_CC) || Z_TYPE_P(pcount) != IS_LONG) { zval_ptr_dtor(pcount); goto outexcept; } Added: php/php-src/branches/PHP_5_3/ext/spl/tests/bug49263.phpt === --- php/php-src/branches/PHP_5_3/ext/spl/tests/bug49263.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/spl/tests/bug49263.phpt2009-10-06 13:34:56 UTC (rev 289250) @@ -0,0 +1,54 @@ +--TEST-- +SPL: SplObjectStorage serialization references +--SKIPIF-- +?php if (!extension_loaded(spl)) print skip; ? +--FILE-- +?php +$o1 = new stdClass; +$o2 = new stdClass; + +$s = new splObjectStorage(); + +$s-attach($o1, array('prev' = 2, 'next' = $o2)); +$s-attach($o2, array('prev' = $o1)); + +$ss = serialize($s); +unset($s,$o1,$o2); +echo $ss.\n; +var_dump(unserialize($ss)); +? +===DONE=== +--EXPECTF-- +C:16:SplObjectStorage:113:{x:i:2;O:8:stdClass:0:{},a:2:{s:4:prev;i:2;s:4:next;O:8:stdClass:0:{}};r:4;,a:1:{s:4:prev;r:1;};m:a:0:{}} +object(SplObjectStorage)#2 (1) { + [storage:SplObjectStorage:private]= + array(2) { +[%s]= +array(2) { + [obj]= + object(stdClass)#1 (0) { + } + [inf]= + array(2) { +[prev]= +int(2) +[next]= +object(stdClass)#3 (0) { +} + } +} +[%s]= +array(2) { + [obj]= + object(stdClass)#3 (0) { + } + [inf]= + array(1) { +[prev]= +object(stdClass)#1 (0) { +} + } +} + } +} +===DONE=== Modified: php/php-src/trunk/ext/spl/spl_observer.c === --- php/php-src/trunk/ext/spl/spl_observer.c2009-10-06 12:53:01 UTC (rev 289249) +++ php/php-src/trunk/ext/spl/spl_observer.c2009-10-06 13:34:56 UTC (rev 289250) @@ -625,7 +625,7 @@ ++p; ALLOC_INIT_ZVAL(pcount); - if (!php_var_unserialize(pcount, p, s + buf_len, var_hash TSRMLS_CC) || Z_TYPE_P(pcount) != IS_LONG) { + if (!php_var_unserialize(pcount, p, s + buf_len, NULL TSRMLS_CC) || Z_TYPE_P(pcount) != IS_LONG) { zval_ptr_dtor(pcount); goto outexcept; } Added: php/php-src/trunk/ext/spl/tests/bug49263.phpt === --- php/php-src/trunk/ext/spl/tests/bug49263.phpt (rev 0) +++ php/php-src/trunk/ext/spl/tests/bug49263.phpt 2009-10-06 13:34:56 UTC (rev 289250) @@ -0,0 +1,54 @@ +--TEST-- +SPL: SplObjectStorage serialization references +--SKIPIF-- +?php if (!extension_loaded(spl)) print skip; ? +--FILE-- +?php +$o1 = new stdClass; +$o2 = new stdClass; + +$s = new splObjectStorage(); + +$s-attach($o1, array('prev' = 2, 'next' = $o2)); +$s-attach($o2, array('prev' = $o1)); + +$ss = serialize($s); +unset($s,$o1,$o2); +echo $ss.\n; +var_dump(unserialize($ss)); +? +===DONE=== +--EXPECTF-- +C:16:SplObjectStorage:113:{x:i:2;O:8:stdClass:0:{},a:2:{U:4:prev;i:2;U:4:next;O:8:stdClass:0:{}};r:4;,a:1:{U:4:prev;r:1;};m:a:0:{}} +object(SplObjectStorage)#2 (1) { +
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/spl/spl_array.c branches/PHP_5_3/ext/spl/spl_dllist.c branches/PHP_5_3/ext/spl/spl_heap.c branches/PHP_5_3/ext/spl/spl_observer.c branches/PHP_5_3/ext
colder Thu, 13 Aug 2009 22:07:05 + Revision: http://svn.php.net/viewvc?view=revisionrevision=287266 Log: Fix several recursion problems when var_dump'ing self-referencing objects Changed paths: U php/php-src/branches/PHP_5_3/ext/spl/spl_array.c U php/php-src/branches/PHP_5_3/ext/spl/spl_dllist.c U php/php-src/branches/PHP_5_3/ext/spl/spl_heap.c U php/php-src/branches/PHP_5_3/ext/spl/spl_observer.c A php/php-src/branches/PHP_5_3/ext/spl/tests/SplObjectStorage_var_dump.phpt A php/php-src/branches/PHP_5_3/ext/spl/tests/array_027.phpt A php/php-src/branches/PHP_5_3/ext/spl/tests/dllist_012.phpt A php/php-src/branches/PHP_5_3/ext/spl/tests/heap_012.phpt U php/php-src/trunk/ext/spl/spl_array.c U php/php-src/trunk/ext/spl/spl_dllist.c U php/php-src/trunk/ext/spl/spl_heap.c U php/php-src/trunk/ext/spl/spl_observer.c A php/php-src/trunk/ext/spl/tests/SplObjectStorage_var_dump.phpt A php/php-src/trunk/ext/spl/tests/array_027.phpt A php/php-src/trunk/ext/spl/tests/dllist_012.phpt A php/php-src/trunk/ext/spl/tests/heap_012.phpt Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_array.c === --- php/php-src/branches/PHP_5_3/ext/spl/spl_array.c 2009-08-13 20:19:31 UTC (rev 287265) +++ php/php-src/branches/PHP_5_3/ext/spl/spl_array.c 2009-08-13 22:07:05 UTC (rev 287266) @@ -76,6 +76,7 @@ zend_class_entry *ce_get_iterator; php_serialize_data_t *serialize_data; php_unserialize_data_t *unserialize_data; + HashTable *debug_info; } spl_array_object; static inline HashTable *spl_array_get_hash_table(spl_array_object* intern, int check_std_props TSRMLS_DC) { /* {{{ */ @@ -144,6 +145,11 @@ zval_ptr_dtor(intern-array); zval_ptr_dtor(intern-retval); + if (intern-debug_info != NULL) { + zend_hash_destroy(intern-debug_info); + efree(intern-debug_info); + } + efree(object); } /* }}} */ @@ -172,6 +178,7 @@ intern-ar_flags = 0; intern-serialize_data = NULL; intern-unserialize_data = NULL; + intern-debug_info = NULL; intern-ce_get_iterator = spl_ce_ArrayIterator; if (orig) { spl_array_object *other = (spl_array_object*)zend_object_store_get_object(orig TSRMLS_CC); @@ -677,32 +684,34 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* {{{ */ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(obj TSRMLS_CC); - HashTable *rv; zval *tmp, *storage; int name_len; char *zname; zend_class_entry *base; + *is_temp = 0; + if (HASH_OF(intern-array) == intern-std.properties) { - *is_temp = 0; return intern-std.properties; } else { - *is_temp = 1; + if (intern-debug_info == NULL) { + ALLOC_HASHTABLE(intern-debug_info); + ZEND_INIT_SYMTABLE_EX(intern-debug_info, zend_hash_num_elements(intern-std.properties) + 1, 0); + } - ALLOC_HASHTABLE(rv); - ZEND_INIT_SYMTABLE_EX(rv, zend_hash_num_elements(intern-std.properties) + 1, 0); + if (intern-debug_info-nApplyCount == 0) { + zend_hash_copy(intern-debug_info, intern-std.properties, (copy_ctor_func_t) zval_add_ref, (void *) tmp, sizeof(zval *)); - zend_hash_copy(rv, intern-std.properties, (copy_ctor_func_t) zval_add_ref, (void *) tmp, sizeof(zval *)); + storage = intern-array; + zval_add_ref(storage); - storage = intern-array; - zval_add_ref(storage); + base = (Z_OBJ_HT_P(obj) == spl_handler_ArrayIterator) ? spl_ce_ArrayIterator : spl_ce_ArrayObject; + zname = spl_gen_private_prop_name(base, storage, sizeof(storage)-1, name_len TSRMLS_CC); + zend_symtable_update(intern-debug_info, zname, name_len+1, storage, sizeof(zval *), NULL); + efree(zname); + } - base = (Z_OBJ_HT_P(obj) == spl_handler_ArrayIterator) ? spl_ce_ArrayIterator : spl_ce_ArrayObject; - zname = spl_gen_private_prop_name(base, storage, sizeof(storage)-1, name_len TSRMLS_CC); - zend_symtable_update(rv, zname, name_len+1, storage, sizeof(zval *), NULL); - efree(zname); - - return rv; + return intern-debug_info; } } /* }}} */ Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_dllist.c === --- php/php-src/branches/PHP_5_3/ext/spl/spl_dllist.c 2009-08-13 20:19:31 UTC (rev 287265) +++ php/php-src/branches/PHP_5_3/ext/spl/spl_dllist.c 2009-08-13 22:07:05 UTC (rev 287266) @@ -94,6 +94,7 @@ zend_function *fptr_offset_del; zend_function *fptr_count; zend_class_entry *ce_get_iterator; + HashTable *debug_info; }; /* define an overloaded iterator structure */ @@ -351,6 +352,11 @@ SPL_LLIST_CHECK_DELREF(intern-traverse_pointer); zval_ptr_dtor(intern-retval); + if (intern-debug_info != NULL) { + zend_hash_destroy(intern-debug_info); + efree(intern-debug_info); + } + efree(object); } /* }}} */ @@ -374,6 +380,7 @@ intern-flags = 0; intern-traverse_position = 0; +
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/Zend/tests/closure_034.phpt branches/PHP_5_3/Zend/zend_closures.c trunk/Zend/tests/closure_034.phpt trunk/Zend/zend_closures.c
colder Mon, 10 Aug 2009 15:18:13 + Revision: http://svn.php.net/viewvc?view=revisionrevision=287043 Log: Fix endless recursion of var_dump() over self-referencing closures Changed paths: A php/php-src/branches/PHP_5_3/Zend/tests/closure_034.phpt U php/php-src/branches/PHP_5_3/Zend/zend_closures.c A php/php-src/trunk/Zend/tests/closure_034.phpt U php/php-src/trunk/Zend/zend_closures.c Added: php/php-src/branches/PHP_5_3/Zend/tests/closure_034.phpt === --- php/php-src/branches/PHP_5_3/Zend/tests/closure_034.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/Zend/tests/closure_034.phpt 2009-08-10 15:18:13 UTC (rev 287043) @@ -0,0 +1,25 @@ +--TEST-- +Closure 033: Recursive var_dump on closures +--FILE-- +?php + +$a = function () use($a) {}; +var_dump($a); + +? +===DONE=== +--EXPECTF-- +object(Closure)#1 (1) { + [static]= + array(1) { +[a]= +object(Closure)#1 (1) { + [static]= + array(1) { +[a]= +*RECURSION* + } +} + } +} +===DONE=== Modified: php/php-src/branches/PHP_5_3/Zend/zend_closures.c === --- php/php-src/branches/PHP_5_3/Zend/zend_closures.c 2009-08-10 14:01:03 UTC (rev 287042) +++ php/php-src/branches/PHP_5_3/Zend/zend_closures.c 2009-08-10 15:18:13 UTC (rev 287043) @@ -37,6 +37,7 @@ typedef struct _zend_closure { zend_objectstd; zend_function func; + HashTable *debug_info; } zend_closure; /* non-static since it needs to be referenced */ @@ -179,6 +180,11 @@ destroy_op_array(closure-func.op_array TSRMLS_CC); } + if (closure-debug_info != NULL) { + zend_hash_destroy(closure-debug_info); + efree(closure-debug_info); + } + efree(closure); } /* }}} */ @@ -222,48 +228,53 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */ { zend_closure *closure = (zend_closure *)zend_object_store_get_object(object TSRMLS_CC); - HashTable *rv; zval *val; struct _zend_arg_info *arg_info = closure-func.common.arg_info; - *is_temp = 1; - ALLOC_HASHTABLE(rv); - zend_hash_init(rv, 1, NULL, ZVAL_PTR_DTOR, 0); - if (closure-func.type == ZEND_USER_FUNCTION closure-func.op_array.static_variables) { - HashTable *static_variables = closure-func.op_array.static_variables; - MAKE_STD_ZVAL(val); - array_init(val); - zend_hash_copy(Z_ARRVAL_P(val), static_variables, (copy_ctor_func_t)zval_add_ref, NULL, sizeof(zval*)); - zend_symtable_update(rv, static, sizeof(static), (void *) val, sizeof(zval *), NULL); + *is_temp = 0; + + if (closure-debug_info == NULL) { + ALLOC_HASHTABLE(closure-debug_info); + zend_hash_init(closure-debug_info, 1, NULL, ZVAL_PTR_DTOR, 0); } + if (closure-debug_info-nApplyCount == 0) { + if (closure-func.type == ZEND_USER_FUNCTION closure-func.op_array.static_variables) { + HashTable *static_variables = closure-func.op_array.static_variables; + MAKE_STD_ZVAL(val); + array_init(val); + zend_hash_copy(Z_ARRVAL_P(val), static_variables, (copy_ctor_func_t)zval_add_ref, NULL, sizeof(zval*)); + zend_symtable_update(closure-debug_info, static, sizeof(static), (void *) val, sizeof(zval *), NULL); + } - if (arg_info) { - zend_uint i, required = closure-func.common.required_num_args; + if (arg_info) { + zend_uint i, required = closure-func.common.required_num_args; - MAKE_STD_ZVAL(val); - array_init(val); + MAKE_STD_ZVAL(val); + array_init(val); - for (i = 0; i closure-func.common.num_args; i++) { - char *name, *info; - int name_len, info_len; - if (arg_info-name) { -name_len = zend_spprintf(name, 0, %s$%s, -arg_info-pass_by_reference ? : , -arg_info-name); - } else { -name_len = zend_spprintf(name, 0, %s$param%d, -arg_info-pass_by_reference ? : , -i + 1); + for (i = 0; i closure-func.common.num_args; i++) { +char *name, *info; +int name_len, info_len; +if (arg_info-name) { + name_len = zend_spprintf(name, 0, %s$%s, + arg_info-pass_by_reference ? : , + arg_info-name); +} else { + name_len = zend_spprintf(name, 0, %s$param%d, + arg_info-pass_by_reference ? : , + i + 1); +} +info_len = zend_spprintf(info, 0, %s, +i = required ? optional : required); +add_assoc_stringl_ex(val, name, name_len + 1, info, info_len, 0); +efree(name); +arg_info++; } - info_len = zend_spprintf(info, 0, %s, - i = required ? optional : required); - add_assoc_stringl_ex(val, name, name_len + 1, info, info_len, 0); - efree(name); - arg_info++; + zend_symtable_update(closure-debug_info, parameter, sizeof(parameter), (void *) val, sizeof(zval *), NULL); } - zend_symtable_update(rv, parameter, sizeof(parameter), (void *) val, sizeof(zval *), NULL); } - return rv; + + return closure-debug_info; } /* }}} */ Added:
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/spl/spl_dllist.c trunk/ext/spl/spl_dllist.c
colder Sun, 02 Aug 2009 21:21:46 + Revision: http://svn.php.net/viewvc?view=revisionrevision=286701 Log: Addref on clone as well Changed paths: U php/php-src/branches/PHP_5_3/ext/spl/spl_dllist.c U php/php-src/trunk/ext/spl/spl_dllist.c Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_dllist.c === --- php/php-src/branches/PHP_5_3/ext/spl/spl_dllist.c 2009-08-02 21:16:14 UTC (rev 286700) +++ php/php-src/branches/PHP_5_3/ext/spl/spl_dllist.c 2009-08-02 21:21:46 UTC (rev 286701) @@ -383,6 +383,7 @@ intern-llist = (spl_ptr_llist *)spl_ptr_llist_init(other-llist-ctor, other-llist-dtor); spl_ptr_llist_copy(other-llist, intern-llist TSRMLS_CC); intern-traverse_pointer = intern-llist-head; + SPL_LLIST_CHECK_ADDREF(intern-traverse_pointer); } else { intern-llist = other-llist; intern-traverse_pointer = intern-llist-head; Modified: php/php-src/trunk/ext/spl/spl_dllist.c === --- php/php-src/trunk/ext/spl/spl_dllist.c 2009-08-02 21:16:14 UTC (rev 286700) +++ php/php-src/trunk/ext/spl/spl_dllist.c 2009-08-02 21:21:46 UTC (rev 286701) @@ -383,6 +383,7 @@ intern-llist = (spl_ptr_llist *)spl_ptr_llist_init(other-llist-ctor, other-llist-dtor); spl_ptr_llist_copy(other-llist, intern-llist TSRMLS_CC); intern-traverse_pointer = intern-llist-head; + SPL_LLIST_CHECK_ADDREF(intern-traverse_pointer); } else { intern-llist = other-llist; intern-traverse_pointer = intern-llist-head; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl_directory.c spl_directory.h
colder Thu Jun 4 14:46:08 2009 UTC Modified files: /php-src/ext/splspl_directory.c spl_directory.h Log: Include other flags as well http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.182r2=1.183diff_format=u Index: php-src/ext/spl/spl_directory.c diff -u php-src/ext/spl/spl_directory.c:1.182 php-src/ext/spl/spl_directory.c:1.183 --- php-src/ext/spl/spl_directory.c:1.182 Mon May 25 14:32:14 2009 +++ php-src/ext/spl/spl_directory.c Thu Jun 4 14:46:08 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.c,v 1.182 2009/05/25 14:32:14 felipe Exp $ */ +/* $Id: spl_directory.c,v 1.183 2009/06/04 14:46:08 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1334,7 +1334,7 @@ { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - RETURN_LONG(intern-flags (SPL_FILE_DIR_KEY_MODE_MASK | SPL_FILE_DIR_CURRENT_MODE_MASK)); + RETURN_LONG(intern-flags (SPL_FILE_DIR_KEY_MODE_MASK | SPL_FILE_DIR_CURRENT_MODE_MASK | SPL_FILE_DIR_OTHERS_MASK)); } /* }}} */ /* {{{ proto void FilesystemIterator::setFlags(long $flags) U @@ -1346,8 +1346,8 @@ zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, flags); - intern-flags = ~(SPL_FILE_DIR_KEY_MODE_MASK|SPL_FILE_DIR_CURRENT_MODE_MASK); - intern-flags |= ((SPL_FILE_DIR_KEY_MODE_MASK|SPL_FILE_DIR_CURRENT_MODE_MASK) flags); + intern-flags = ~(SPL_FILE_DIR_KEY_MODE_MASK|SPL_FILE_DIR_CURRENT_MODE_MASK|SPL_FILE_DIR_OTHERS_MASK); + intern-flags |= ((SPL_FILE_DIR_KEY_MODE_MASK|SPL_FILE_DIR_CURRENT_MODE_MASK|SPL_FILE_DIR_OTHERS_MASK) flags); } /* }}} */ /* {{{ proto bool RecursiveDirectoryIterator::hasChildren([bool $allow_links = false]) U http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.h?r1=1.48r2=1.49diff_format=u Index: php-src/ext/spl/spl_directory.h diff -u php-src/ext/spl/spl_directory.h:1.48 php-src/ext/spl/spl_directory.h:1.49 --- php-src/ext/spl/spl_directory.h:1.48Tue Mar 10 23:39:38 2009 +++ php-src/ext/spl/spl_directory.h Thu Jun 4 14:46:08 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.h,v 1.48 2009/03/10 23:39:38 helly Exp $ */ +/* $Id: spl_directory.h,v 1.49 2009/06/04 14:46:08 colder Exp $ */ #ifndef SPL_DIRECTORY_H #define SPL_DIRECTORY_H @@ -137,6 +137,7 @@ #define SPL_FILE_DIR_SKIPDOTS 0x1000 /* Tells whether it should skip dots or not */ #define SPL_FILE_DIR_UNIXPATHS 0x2000 /* Whether to unixify path separators */ +#define SPL_FILE_DIR_OTHERS_MASK 0x3000 /* mask used for get/setFlags */ #endif /* SPL_DIRECTORY_H */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_directory.c spl_directory.h
colder Thu Jun 4 14:46:26 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_directory.c spl_directory.h Log: MFH: Include other flags as well http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.23.2.42r2=1.45.2.27.2.23.2.43diff_format=u Index: php-src/ext/spl/spl_directory.c diff -u php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.42 php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.43 --- php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.42 Sat May 9 21:06:58 2009 +++ php-src/ext/spl/spl_directory.c Thu Jun 4 14:46:26 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.42 2009/05/09 21:06:58 colder Exp $ */ +/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.43 2009/06/04 14:46:26 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1216,7 +1216,7 @@ { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - RETURN_LONG(intern-flags (SPL_FILE_DIR_KEY_MODE_MASK | SPL_FILE_DIR_CURRENT_MODE_MASK)); + RETURN_LONG(intern-flags (SPL_FILE_DIR_KEY_MODE_MASK | SPL_FILE_DIR_CURRENT_MODE_MASK | SPL_FILE_DIR_OTHERS_MASK)); } /* }}} */ /* {{{ proto void FilesystemIterator::setFlags(long $flags) @@ -1228,8 +1228,8 @@ zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, flags); - intern-flags = ~(SPL_FILE_DIR_KEY_MODE_MASK|SPL_FILE_DIR_CURRENT_MODE_MASK); - intern-flags |= ((SPL_FILE_DIR_KEY_MODE_MASK|SPL_FILE_DIR_CURRENT_MODE_MASK) flags); + intern-flags = ~(SPL_FILE_DIR_KEY_MODE_MASK|SPL_FILE_DIR_CURRENT_MODE_MASK|SPL_FILE_DIR_OTHERS_MASK); + intern-flags |= ((SPL_FILE_DIR_KEY_MODE_MASK|SPL_FILE_DIR_CURRENT_MODE_MASK|SPL_FILE_DIR_OTHERS_MASK) flags); } /* }}} */ /* {{{ proto bool RecursiveDirectoryIterator::hasChildren([bool $allow_links = false]) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.h?r1=1.12.2.5.2.4.2.13r2=1.12.2.5.2.4.2.14diff_format=u Index: php-src/ext/spl/spl_directory.h diff -u php-src/ext/spl/spl_directory.h:1.12.2.5.2.4.2.13 php-src/ext/spl/spl_directory.h:1.12.2.5.2.4.2.14 --- php-src/ext/spl/spl_directory.h:1.12.2.5.2.4.2.13 Wed Dec 31 11:15:43 2008 +++ php-src/ext/spl/spl_directory.h Thu Jun 4 14:46:26 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.h,v 1.12.2.5.2.4.2.13 2008/12/31 11:15:43 sebastian Exp $ */ +/* $Id: spl_directory.h,v 1.12.2.5.2.4.2.14 2009/06/04 14:46:26 colder Exp $ */ #ifndef SPL_DIRECTORY_H #define SPL_DIRECTORY_H @@ -134,6 +134,7 @@ #define SPL_FILE_DIR_SKIPDOTS 0x1000 /* Tells whether it should skip dots or not */ #define SPL_FILE_DIR_UNIXPATHS 0x2000 /* Whether to unixify path separators */ +#define SPL_FILE_DIR_OTHERS_MASK 0x3000 /* mask used for get/setFlags */ #endif /* SPL_DIRECTORY_H */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /tests/lang 045.phpt
colder Sun May 31 21:32:20 2009 UTC Added files: /php-src/tests/lang 045.phpt Log: Add test for the timeout inside shutdown function http://cvs.php.net/viewvc.cgi/php-src/tests/lang/045.phpt?view=markuprev=1.1 Index: php-src/tests/lang/045.phpt +++ php-src/tests/lang/045.phpt --TEST-- Timeout again inside register_shutdown_function --FILE-- ?php set_time_limit(1); register_shutdown_function(plop); function plop() { $ts = time(); while(true) { if ((time()-$ts) 2) { echo Failed!; break; } } } plop(); ? ===DONE=== --EXPECTF-- Fatal error: Maximum execution time of 1 second exceeded in %s on line %d Fatal error: Maximum execution time of 1 second exceeded in %s on line %d -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /tests/lang 045.phpt
colder Sun May 31 21:32:42 2009 UTC Added files: (Branch: PHP_5_3) /php-src/tests/lang 045.phpt Log: MFH: Add test for the timeout inside shutdown function http://cvs.php.net/viewvc.cgi/php-src/tests/lang/045.phpt?view=markuprev=1.1 Index: php-src/tests/lang/045.phpt +++ php-src/tests/lang/045.phpt --TEST-- Timeout again inside register_shutdown_function --FILE-- ?php set_time_limit(1); register_shutdown_function(plop); function plop() { $ts = time(); while(true) { if ((time()-$ts) 2) { echo Failed!; break; } } } plop(); ? ===DONE=== --EXPECTF-- Fatal error: Maximum execution time of 1 second exceeded in %s on line %d Fatal error: Maximum execution time of 1 second exceeded in %s on line %d -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /main SAPI.c SAPI.h main.c php_globals.h /sapi/apache mod_php5.c ZendEngine2 zend_execute.h zend_execute_API.c
Hello, if I get no objections by the end of the week I'll simply commit that patch + test, so 5.3 can move forward. Regards, On Sun, May 24, 2009 at 1:53 PM, Etienne Kneuss col...@php.net wrote: Hello, this patch introduced a bug in 5_3/HEAD, the timeout is no longer checked in the shutdown function: set_time_limit(1); register_shutdown_function(plop); function plop() { while(1); } plop(); doesn't terminate http://patches.colder.ch/php-src/shutdown_timeout-5_3.patch?markup fixes it but I'm not sure it's the right way to do it. Can you please take a look? Thanks. On Tue, Mar 18, 2008 at 11:42 PM, Rasmus Lerdorf ras...@php.net wrote: rasmus Tue Mar 18 21:42:51 2008 UTC Modified files: (Branch: PHP_5_3) /ZendEngine2zend_execute.h zend_execute_API.c /php-src/main SAPI.c SAPI.h main.c php_globals.h /php-src/sapi/apachemod_php5.c Log: exit_on_timeout patch After the sigsetjmp change, this is patch #2 in an effort to get some sanity restored to signal handling in PHP. This patch does two things. First, it makes it possible to reset the timeout without resetting the signal handlers. This is important for cases where an extension may have deferred signals in its MINIT in order to implement critical sections. It also lays the groundwork for cleaning up our signal handling and perhaps eventually implementing our own signal deferring mechanism so we can have true critical sections. The second thing this does is to make it possible to terminate the current child process (only for Apache1 at the moment) on a timeout. There are a number of extensions that are unhappy about being longjmp'ed out of and when this happens on a timeout they are left in an inconsistent state. By turning on exit_on_timeout you can now force the process to terminate on a timeout which will clean up any hanging locks and/or memory left hanging after the longjmp. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Etienne Kneuss http://www.colder.ch Men never do evil so completely and cheerfully as when they do it from a religious conviction. -- Pascal -- Etienne Kneuss http://www.colder.ch Men never do evil so completely and cheerfully as when they do it from a religious conviction. -- Pascal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /main SAPI.c SAPI.h main.c php_globals.h /sapi/apache mod_php5.c ZendEngine2 zend_execute.h zend_execute_API.c
Hello, this patch introduced a bug in 5_3/HEAD, the timeout is no longer checked in the shutdown function: set_time_limit(1); register_shutdown_function(plop); function plop() { while(1); } plop(); doesn't terminate http://patches.colder.ch/php-src/shutdown_timeout-5_3.patch?markup fixes it but I'm not sure it's the right way to do it. Can you please take a look? Thanks. On Tue, Mar 18, 2008 at 11:42 PM, Rasmus Lerdorf ras...@php.net wrote: rasmus      Tue Mar 18 21:42:51 2008 UTC  Modified files:        (Branch: PHP_5_3)   /ZendEngine2     zend_execute.h zend_execute_API.c   /php-src/main    SAPI.c SAPI.h main.c php_globals.h   /php-src/sapi/apache     mod_php5.c  Log:  exit_on_timeout patch  After the sigsetjmp change, this is patch #2 in an effort to get some  sanity restored to signal handling in PHP.  This patch does two things.  First, it makes it possible to reset the  timeout without resetting the signal handlers.  This is important for  cases where an extension may have deferred signals in its MINIT in order  to implement critical sections. It also lays the groundwork for cleaning  up our signal handling and perhaps eventually implementing our own  signal deferring mechanism so we can have true critical sections.  The second thing this does is to make it possible to terminate the current  child process (only for Apache1 at the moment) on a timeout.  There are  a number of extensions that are unhappy about being longjmp'ed out of  and when this happens on a timeout they are left in an inconsistent state.  By turning on exit_on_timeout you can now force the process to terminate  on a timeout which will clean up any hanging locks and/or memory left  hanging after the longjmp. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Etienne Kneuss http://www.colder.ch Men never do evil so completely and cheerfully as when they do it from a religious conviction. -- Pascal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/standard array.c
colder Sun May 10 16:45:03 2009 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/ext/standard array.c Log: Fix #48224 (Remove incorrect shuffle) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1496r2=1.2027.2.547.2.1497diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1496 php-src/NEWS:1.2027.2.547.2.1497 --- php-src/NEWS:1.2027.2.547.2.1496Sun May 10 15:15:47 2009 +++ php-src/NEWSSun May 10 16:45:01 2009 @@ -12,6 +12,7 @@ - Fixed segfault on invalid session.save_path. (Hannes) - Fixed leaks in imap when a mail_criteria is used. (Pierre) +- Fixed bug #48224 (Incorrect shuffle in array_rand). (Etienne) - Fixed bug #48221 (memory leak when passing invalid xslt parameter). (Felipe) - Fixed bug #48206 (Iterating over an invalid data structure with RecursiveIteratorIterator leads to a segfault). (Scott) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.65r2=1.308.2.21.2.66diff_format=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.308.2.21.2.65 php-src/ext/standard/array.c:1.308.2.21.2.66 --- php-src/ext/standard/array.c:1.308.2.21.2.65Fri Feb 13 22:26:46 2009 +++ php-src/ext/standard/array.cSun May 10 16:45:01 2009 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: array.c,v 1.308.2.21.2.65 2009/02/13 22:26:46 andrei Exp $ */ +/* $Id: array.c,v 1.308.2.21.2.66 2009/05/10 16:45:01 colder Exp $ */ #include php.h #include php_ini.h @@ -4204,10 +4204,6 @@ num_avail--; zend_hash_move_forward_ex(Z_ARRVAL_PP(input), pos); } - - if (num_req_val == num_avail) { - array_data_shuffle(return_value TSRMLS_CC); - } } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard array.c
colder Sun May 10 16:45:21 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard array.c Log: MFB: Fix #48224 (Remove incorrect shuffle) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.37.2.53r2=1.308.2.21.2.37.2.54diff_format=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.308.2.21.2.37.2.53 php-src/ext/standard/array.c:1.308.2.21.2.37.2.54 --- php-src/ext/standard/array.c:1.308.2.21.2.37.2.53 Fri Feb 13 22:34:15 2009 +++ php-src/ext/standard/array.cSun May 10 16:45:21 2009 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: array.c,v 1.308.2.21.2.37.2.53 2009/02/13 22:34:15 andrei Exp $ */ +/* $Id: array.c,v 1.308.2.21.2.37.2.54 2009/05/10 16:45:21 colder Exp $ */ #include php.h #include php_ini.h @@ -3920,10 +3920,6 @@ num_avail--; zend_hash_move_forward_ex(Z_ARRVAL_P(input), pos); } - - if (num_req == num_avail) { - php_array_data_shuffle(return_value TSRMLS_CC); - } } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard array.c
colder Sun May 10 16:45:30 2009 UTC Modified files: /php-src/ext/standard array.c Log: MFB: Fix #48224 (Remove incorrect shuffle) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.475r2=1.476diff_format=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.475 php-src/ext/standard/array.c:1.476 --- php-src/ext/standard/array.c:1.475 Thu Mar 26 20:02:28 2009 +++ php-src/ext/standard/array.cSun May 10 16:45:30 2009 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: array.c,v 1.475 2009/03/26 20:02:28 felipe Exp $ */ +/* $Id: array.c,v 1.476 2009/05/10 16:45:30 colder Exp $ */ #include php.h #include php_ini.h @@ -4114,10 +4114,6 @@ num_avail--; zend_hash_move_forward_ex(Z_ARRVAL_P(input), pos); } - - if (num_req == num_avail) { - php_array_data_shuffle(return_value TSRMLS_CC); - } } /* }}} */ -- 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/standard/tests/array bug48224.phpt
colder Sun May 10 20:11:36 2009 UTC Added files: (Branch: PHP_5_2) /php-src/ext/standard/tests/array bug48224.phpt Log: Add test for #48224 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/bug48224.phpt?view=markuprev=1.1 Index: php-src/ext/standard/tests/array/bug48224.phpt +++ php-src/ext/standard/tests/array/bug48224.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard/tests/array bug48224.phpt
colder Sun May 10 20:12:56 2009 UTC Added files: (Branch: PHP_5_3) /php-src/ext/standard/tests/array bug48224.phpt Log: MFB: Add test for #48224 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/bug48224.phpt?view=markuprev=1.1 Index: php-src/ext/standard/tests/array/bug48224.phpt +++ php-src/ext/standard/tests/array/bug48224.phpt -- 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 bug48224.phpt
colder Sun May 10 20:13:08 2009 UTC Modified files: /php-src/ext/standard/tests/array bug48224.phpt Log: MFB: Add test for #48224 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/bug48224.phpt?r1=1.1r2=1.2diff_format=u Index: php-src/ext/standard/tests/array/bug48224.phpt diff -u /dev/null php-src/ext/standard/tests/array/bug48224.phpt:1.2 --- /dev/null Sun May 10 20:13:08 2009 +++ php-src/ext/standard/tests/array/bug48224.phpt Sun May 10 20:13:08 2009 @@ -0,0 +1,15 @@ +--TEST-- +Bug #48224 (array_rand no longer shuffles) +--FILE-- +?php +$a = range(0, 100); +$a1 = array_rand($a, count($a)); +$a2 = array_rand($a, count($a)); +$a3 = array_rand($a, count($a)); +$a4 = array_rand($a, count($a)); + +var_dump($a1 === $a2 $a1 === $a3 $a1 === $a4); + +? +--EXPECT-- +bool(true) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard array.c
2009/5/10 Johannes Schlüter johan...@php.net: On Sun, 2009-05-10 at 16:45 +, Etienne Kneuss wrote: colder         Sun May 10 16:45:21 2009 UTC  Modified files:        (Branch: PHP_5_3)   /php-src/ext/standard   array.c  Log:  MFB: Fix #48224 (Remove incorrect shuffle) Any chance to cover this in a test? - I know it involves randomness. Maybe multiple calls to array_rand() and check if it's always in right order or something? Yeah, I added a === check which should have a low probability of passing with shuffles johannes -- Etienne Kneuss http://www.colder.ch Men never do evil so completely and cheerfully as when they do it from a religious conviction. -- Pascal -- 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/spl/tests bug47534.phpt
colder Sat May 9 20:58:34 2009 UTC Added files: (Branch: PHP_5_2) /php-src/ext/spl/tests bug47534.phpt Log: Add test for bug #47534 http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug47534.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/bug47534.phpt +++ php-src/ext/spl/tests/bug47534.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl_directory.c /ext/spl/tests bug47534.phpt
colder Sat May 9 21:05:18 2009 UTC Modified files: /php-src/ext/spl/tests bug47534.phpt /php-src/ext/splspl_directory.c Log: Fix bug #47534 (RecursiveDirectoryIterator::getChildren ignoring CURRENT_AS_PATHNAME) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug47534.phpt?r1=1.1r2=1.2diff_format=u Index: php-src/ext/spl/tests/bug47534.phpt diff -u /dev/null php-src/ext/spl/tests/bug47534.phpt:1.2 --- /dev/null Sat May 9 21:05:18 2009 +++ php-src/ext/spl/tests/bug47534.phpt Sat May 9 21:05:18 2009 @@ -0,0 +1,14 @@ +--TEST-- +SPL: RecursiveDirectoryIterator bug 47534 +--FILE-- +?php +$it1 = new RecursiveDirectoryIterator(dirname(__FILE__), FileSystemIterator::CURRENT_AS_PATHNAME); +$it1-rewind(); +echo gettype($it1-current()).\n; + +$it2 = new RecursiveDirectoryIterator(dirname(__FILE__)); +$it2-rewind(); +echo gettype($it2-current()).\n; +--EXPECT-- +unicode +object http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.180r2=1.181diff_format=u Index: php-src/ext/spl/spl_directory.c diff -u php-src/ext/spl/spl_directory.c:1.180 php-src/ext/spl/spl_directory.c:1.181 --- php-src/ext/spl/spl_directory.c:1.180 Thu Mar 26 20:02:12 2009 +++ php-src/ext/spl/spl_directory.c Sat May 9 21:05:18 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.c,v 1.180 2009/03/26 20:02:12 felipe Exp $ */ +/* $Id: spl_directory.c,v 1.181 2009/05/09 21:05:18 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1386,28 +1386,32 @@ spl_filesystem_object_get_file_name(intern TSRMLS_CC); - INIT_PZVAL(zflags); - INIT_PZVAL(zpath); - ZVAL_LONG(zflags, intern-flags); - ZVAL_ZSTRL(zpath, intern-file_name_type, intern-file_name, intern-file_name_len, 1); - - spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, 0, zpath, zflags TSRMLS_CC); - - zval_dtor(zpath); - - subdir = (spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC); - if (subdir) { - if (intern-u.dir.sub_path.v intern-u.dir.sub_path_len 1) { - subdir-u.dir.sub_path_type = intern-u.dir.sub_path_type; - subdir-u.dir.sub_path_len = zspprintf(intern-u.dir.sub_path_type, subdir-u.dir.sub_path, 0, %R%c%s, intern-u.dir.sub_path_type, intern-u.dir.sub_path, slash, intern-u.dir.entry.d_name); - } else { - subdir-u.dir.sub_path_len = strlen(intern-u.dir.entry.d_name); - subdir-u.dir.sub_path_type = IS_STRING; - subdir-u.dir.sub_path.s = estrndup(intern-u.dir.entry.d_name, subdir-u.dir.sub_path_len); - } - subdir-info_class = intern-info_class; - subdir-file_class = intern-file_class; - subdir-oth = intern-oth; + if (SPL_HAS_FLAG(intern-flags, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) { + RETURN_ZSTRL(intern-file_name_type, intern-file_name, intern-file_name_len, 1); + } else { + INIT_PZVAL(zflags); + INIT_PZVAL(zpath); + ZVAL_LONG(zflags, intern-flags); + ZVAL_ZSTRL(zpath, intern-file_name_type, intern-file_name, intern-file_name_len, 1); + + spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, 0, zpath, zflags TSRMLS_CC); + + zval_dtor(zpath); + + subdir = (spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC); + if (subdir) { + if (intern-u.dir.sub_path.v intern-u.dir.sub_path_len 1) { + subdir-u.dir.sub_path_type = intern-u.dir.sub_path_type; + subdir-u.dir.sub_path_len = zspprintf(intern-u.dir.sub_path_type, subdir-u.dir.sub_path, 0, %R%c%s, intern-u.dir.sub_path_type, intern-u.dir.sub_path, slash, intern-u.dir.entry.d_name); + } else { + subdir-u.dir.sub_path_len = strlen(intern-u.dir.entry.d_name); + subdir-u.dir.sub_path_type = IS_STRING; + subdir-u.dir.sub_path.s = estrndup(intern-u.dir.entry.d_name, subdir-u.dir.sub_path_len); + } + subdir-info_class = intern-info_class; + subdir-file_class = intern-file_class; + subdir-oth = intern-oth; + } } } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_directory.c /ext/spl/tests bug47534.phpt
colder Sat May 9 21:06:59 2009 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests bug47534.phpt Modified files: /php-src/ext/splspl_directory.c /php-srcNEWS Log: MFH: Fix bug #47534 (RecursiveDirectoryIterator::getChildren ignoring CURRENT_AS_PATHNAME) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.23.2.41r2=1.45.2.27.2.23.2.42diff_format=u Index: php-src/ext/spl/spl_directory.c diff -u php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.41 php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.42 --- php-src/ext/spl/spl_directory.c:1.45.2.27.2.23.2.41 Tue Mar 10 23:28:17 2009 +++ php-src/ext/spl/spl_directory.c Sat May 9 21:06:58 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.41 2009/03/10 23:28:17 helly Exp $ */ +/* $Id: spl_directory.c,v 1.45.2.27.2.23.2.42 2009/05/09 21:06:58 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1268,24 +1268,27 @@ spl_filesystem_object_get_file_name(intern TSRMLS_CC); - INIT_PZVAL(zflags); - INIT_PZVAL(zpath); - ZVAL_LONG(zflags, intern-flags); - ZVAL_STRINGL(zpath, intern-file_name, intern-file_name_len, 0); - - spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, 0, zpath, zflags TSRMLS_CC); - - subdir = (spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC); - if (subdir) { - if (intern-u.dir.sub_path intern-u.dir.sub_path[0]) { - subdir-u.dir.sub_path_len = spprintf(subdir-u.dir.sub_path, 0, %s%c%s, intern-u.dir.sub_path, slash, intern-u.dir.entry.d_name); - } else { - subdir-u.dir.sub_path_len = strlen(intern-u.dir.entry.d_name); - subdir-u.dir.sub_path = estrndup(intern-u.dir.entry.d_name, subdir-u.dir.sub_path_len); + if (SPL_HAS_FLAG(intern-flags, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) { + RETURN_STRINGL(intern-file_name, intern-file_name_len, 1); + } else { + INIT_PZVAL(zflags); + INIT_PZVAL(zpath); + ZVAL_LONG(zflags, intern-flags); + ZVAL_STRINGL(zpath, intern-file_name, intern-file_name_len, 0); + spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, 0, zpath, zflags TSRMLS_CC); + + subdir = (spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC); + if (subdir) { + if (intern-u.dir.sub_path intern-u.dir.sub_path[0]) { + subdir-u.dir.sub_path_len = spprintf(subdir-u.dir.sub_path, 0, %s%c%s, intern-u.dir.sub_path, slash, intern-u.dir.entry.d_name); + } else { + subdir-u.dir.sub_path_len = strlen(intern-u.dir.entry.d_name); + subdir-u.dir.sub_path = estrndup(intern-u.dir.entry.d_name, subdir-u.dir.sub_path_len); + } + subdir-info_class = intern-info_class; + subdir-file_class = intern-file_class; + subdir-oth = intern-oth; } - subdir-info_class = intern-info_class; - subdir-file_class = intern-file_class; - subdir-oth = intern-oth; } } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.593r2=1.2027.2.547.2.965.2.594diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.593 php-src/NEWS:1.2027.2.547.2.965.2.594 --- php-src/NEWS:1.2027.2.547.2.965.2.593 Sat May 9 20:42:44 2009 +++ php-src/NEWSSat May 9 21:06:59 2009 @@ -63,6 +63,8 @@ - Fixed bug #47560 (explode()'s limit parameter odd behaviour). (Matt) - Fixed bug #47535 (Compilation failure in ps_fetch_from_1_to_8_bytes()). (Johannes) +- Fixed bug #47534 (RecursiveDiteratoryIterator::getChildren ignoring + CURRENT_AS_PATHNAME). (Etienne) - Fixed bug #47516 (nowdoc can not be embed in heredoc but can be embed in double quote). (Dmitry) - Fixed bug #47038 (Memory leak in include). (Dmitry) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug47534.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/bug47534.phpt +++ php-src/ext/spl/tests/bug47534.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl php_spl.c /ext/spl/tests bug48023.phpt
colder Mon Apr 20 14:20:20 2009 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests bug48023.phpt Modified files: /php-src/ext/splphp_spl.c /php-srcNEWS Log: MFH: Fix #48023 (spl_autoload_register didn't store closures) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.17.2.35r2=1.52.2.28.2.17.2.36diff_format=u Index: php-src/ext/spl/php_spl.c diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.35 php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.36 --- php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.35 Mon Jan 26 11:38:03 2009 +++ php-src/ext/spl/php_spl.c Mon Apr 20 14:20:20 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_spl.c,v 1.52.2.28.2.17.2.35 2009/01/26 11:38:03 colder Exp $ */ +/* $Id: php_spl.c,v 1.52.2.28.2.17.2.36 2009/04/20 14:20:20 colder Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -353,6 +353,7 @@ typedef struct { zend_function *func_ptr; zval *obj; + zval *closure; zend_class_entry *ce; } autoload_func_info; @@ -361,6 +362,9 @@ if (alfi-obj) { zval_ptr_dtor(alfi-obj); } + if (alfi-closure) { + zval_ptr_dtor(alfi-closure); + } } /* {{{ proto void spl_autoload_call(string class_name) @@ -488,9 +492,14 @@ RETURN_FALSE; } } + alfi.closure = NULL; alfi.ce = fcc.calling_scope; alfi.func_ptr = fcc.function_handler; obj_ptr = fcc.object_ptr; + if (Z_TYPE_P(zcallable) == IS_OBJECT) { + alfi.closure = zcallable; + Z_ADDREF_P(zcallable); + } if (error) { efree(error); } @@ -527,6 +536,7 @@ spl_alfi.func_ptr = spl_func_ptr; spl_alfi.obj = NULL; spl_alfi.ce = NULL; + spl_alfi.closure = NULL; zend_hash_add(SPL_G(autoload_functions), spl_autoload, sizeof(spl_autoload), spl_alfi, sizeof(autoload_func_info), NULL); if (prepend SPL_G(autoload_functions)-nNumOfElements 1) { /* Move the newly created element to the head of the hashtable */ http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.564r2=1.2027.2.547.2.965.2.565diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.564 php-src/NEWS:1.2027.2.547.2.965.2.565 --- php-src/NEWS:1.2027.2.547.2.965.2.564 Mon Apr 20 14:08:43 2009 +++ php-src/NEWSMon Apr 20 14:20:20 2009 @@ -12,6 +12,7 @@ disable this behaviour using http=array(auto_decode=0) in stream context. (Dmitry) +- Fixed bug #48023 (spl_autoload_register didn't store closures). (Etienne) - Fixed bug #47880 (crashes in call_user_func_array()). (Dmitry) - Fixed bug #47856 (stristr() converts needle to lower-case). (Ilia) - Fixed bug #47851 (is_callable throws fatal error). (Dmitry) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug48023.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/bug48023.phpt +++ php-src/ext/spl/tests/bug48023.phpt --TEST-- Bug #48023 (spl_autoload_register didn't addref closures) --FILE-- ?php spl_autoload_register(function(){}); new Foo; ? ===DONE=== --EXPECTF-- Fatal error: Class 'Foo' not found in %s on line %d -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl php_spl.c /ext/spl/tests bug48023.phpt
colder Mon Apr 20 14:18:46 2009 UTC Added files: /php-src/ext/spl/tests bug48023.phpt Modified files: /php-src/ext/splphp_spl.c Log: Fix #48023 (spl_autoload_register didn't store closures) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.152r2=1.153diff_format=u Index: php-src/ext/spl/php_spl.c diff -u php-src/ext/spl/php_spl.c:1.152 php-src/ext/spl/php_spl.c:1.153 --- php-src/ext/spl/php_spl.c:1.152 Thu Mar 26 20:02:12 2009 +++ php-src/ext/spl/php_spl.c Mon Apr 20 14:18:46 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_spl.c,v 1.152 2009/03/26 20:02:12 felipe Exp $ */ +/* $Id: php_spl.c,v 1.153 2009/04/20 14:18:46 colder Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -337,6 +337,7 @@ typedef struct { zend_function *func_ptr; zval *obj; + zval *closure; zend_class_entry *ce; } autoload_func_info; @@ -345,6 +346,9 @@ if (alfi-obj) { zval_ptr_dtor(alfi-obj); } + if (alfi-closure) { + zval_ptr_dtor(alfi-closure); + } } /* {{{ proto void spl_autoload_call(string class_name) U @@ -485,9 +489,14 @@ RETURN_FALSE; } } + alfi.closure = NULL; alfi.ce = fcc.calling_scope; alfi.func_ptr = fcc.function_handler; obj_ptr = fcc.object_ptr; + if (Z_TYPE_P(zcallable) == IS_OBJECT) { + alfi.closure = zcallable; + Z_ADDREF_P(zcallable); + } if (error) { efree(error); } @@ -531,6 +540,7 @@ spl_alfi.func_ptr = spl_func_ptr; spl_alfi.obj = NULL; spl_alfi.ce = NULL; + spl_alfi.closure = NULL; zend_hash_add(SPL_G(autoload_functions), spl_autoload, sizeof(spl_autoload), spl_alfi, sizeof(autoload_func_info), NULL); if (prepend SPL_G(autoload_functions)-nNumOfElements 1) { /* Move the newly created element to the head of the hashtable */ http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug48023.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/bug48023.phpt +++ php-src/ext/spl/tests/bug48023.phpt --TEST-- Bug #48023 (spl_autoload_register didn't addref closures) --FILE-- ?php spl_autoload_register(function(){}); new Foo; ? ===DONE=== --EXPECTF-- Fatal error: Class 'Foo' not found in %s on line %d -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl_observer.c
colder Thu Mar 19 02:44:04 2009 UTC Modified files: /php-src/ext/splspl_observer.c Log: Fix #47671 (cloning SplObjectStorage instances) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_observer.c?r1=1.33r2=1.34diff_format=u Index: php-src/ext/spl/spl_observer.c diff -u php-src/ext/spl/spl_observer.c:1.33 php-src/ext/spl/spl_observer.c:1.34 --- php-src/ext/spl/spl_observer.c:1.33 Tue Mar 10 23:39:38 2009 +++ php-src/ext/spl/spl_observer.c Thu Mar 19 02:44:04 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: spl_observer.c,v 1.33 2009/03/10 23:39:38 helly Exp $ */ +/* $Id: spl_observer.c,v 1.34 2009/03/19 02:44:04 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -106,6 +106,85 @@ zval_ptr_dtor(element-inf); } /* }}} */ +spl_SplObjectStorageElement* spl_object_storage_get(spl_SplObjectStorage *intern, zval *obj TSRMLS_DC) /* {{{ */ +{ + spl_SplObjectStorageElement *element; + zend_object_value *pzvalue; +#if HAVE_PACKED_OBJECT_VALUE + pzvalue = Z_OBJVAL_P(obj); +#else + zend_object_value zvalue; + memset(zvalue, 0, sizeof(zend_object_value)); + zvalue.handle = Z_OBJ_HANDLE_P(obj); + zvalue.handlers = Z_OBJ_HT_P(obj); + pzvalue = zvalue; +#endif + if (zend_hash_find(intern-storage, (char*)pzvalue, sizeof(zend_object_value), (void**)element) == SUCCESS) { + return element; + } else { + return NULL; + } +} /* }}} */ + +void spl_object_storage_attach(spl_SplObjectStorage *intern, zval *obj, zval *inf TSRMLS_DC) /* {{{ */ +{ + spl_SplObjectStorageElement *pelement, element; + pelement = spl_object_storage_get(intern, obj TSRMLS_CC); + if (inf) { + Z_ADDREF_P(inf); + } else { + ALLOC_INIT_ZVAL(inf); + } + if (pelement) { + zval_ptr_dtor(pelement-inf); + pelement-inf = inf; + return; + } + Z_ADDREF_P(obj); + element.obj = obj; + element.inf = inf; +#if HAVE_PACKED_OBJECT_VALUE + zend_hash_update(intern-storage, (char*)Z_OBJVAL_P(obj), sizeof(zend_object_value), element, sizeof(spl_SplObjectStorageElement), NULL); +#else + { + zend_object_value zvalue; + memset(zvalue, 0, sizeof(zend_object_value)); + zvalue.handle = Z_OBJ_HANDLE_P(obj); + zvalue.handlers = Z_OBJ_HT_P(obj); + zend_hash_update(intern-storage, (char*)zvalue, sizeof(zend_object_value), element, sizeof(spl_SplObjectStorageElement), NULL); + } +#endif +} /* }}} */ + +void spl_object_storage_detach(spl_SplObjectStorage *intern, zval *obj TSRMLS_DC) /* {{{ */ +{ +#if HAVE_PACKED_OBJECT_VALUE + zend_hash_del(intern-storage, (char*)Z_OBJVAL_P(obj), sizeof(zend_object_value)); +#else + { + zend_object_value zvalue; + memset(zvalue, 0, sizeof(zend_object_value)); + zvalue.handle = Z_OBJ_HANDLE_P(obj); + zvalue.handlers = Z_OBJ_HT_P(obj); + zend_hash_del(intern-storage, (char*)zvalue, sizeof(zend_object_value)); + } +#endif +} /* }}}*/ + +void spl_object_storage_addall(spl_SplObjectStorage *intern, spl_SplObjectStorage *other TSRMLS_DC) { /* {{{ */ + spl_SplObjectStorageElement *element; + HashPosition pos; + + zend_hash_internal_pointer_reset_ex(other-storage, pos); + while (zend_hash_get_current_data_ex(other-storage, (void **)element, pos) == SUCCESS) { + spl_object_storage_attach(intern, element-obj, element-inf TSRMLS_CC); + zend_hash_move_forward_ex(other-storage, pos); + } + + zend_hash_internal_pointer_reset_ex(intern-storage, intern-pos); + intern-index = 0; +} /* }}} */ + static zend_object_value spl_object_storage_new_ex(zend_class_entry *class_type, spl_SplObjectStorage **obj, zval *orig TSRMLS_DC) /* {{{ */ { zend_object_value retval; @@ -123,10 +202,36 @@ retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) spl_SplOjectStorage_free_storage, NULL TSRMLS_CC); retval.handlers = spl_handler_SplObjectStorage; + + if (orig) { + spl_SplObjectStorage *other = (spl_SplObjectStorage*)zend_object_store_get_object(orig TSRMLS_CC); + spl_object_storage_addall(intern, other TSRMLS_CC); + } + return retval; } /* }}} */ +/* {{{ spl_object_storage_clone */ +static zend_object_value spl_object_storage_clone(zval *zobject TSRMLS_DC) +{ + zend_object_value new_obj_val; + zend_object *old_object; + zend_object *new_object; + zend_object_handle handle = Z_OBJ_HANDLE_P(zobject); + spl_SplObjectStorage *intern; + + old_object =
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_observer.c
colder Thu Mar 19 02:45:19 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_observer.c /php-srcNEWS Log: MFH: Fix #47671 (cloning SplObjectStorage instances) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_observer.c?r1=1.2.2.6.2.3.2.16r2=1.2.2.6.2.3.2.17diff_format=u Index: php-src/ext/spl/spl_observer.c diff -u php-src/ext/spl/spl_observer.c:1.2.2.6.2.3.2.16 php-src/ext/spl/spl_observer.c:1.2.2.6.2.3.2.17 --- php-src/ext/spl/spl_observer.c:1.2.2.6.2.3.2.16 Fri Jan 16 22:20:53 2009 +++ php-src/ext/spl/spl_observer.c Thu Mar 19 02:45:17 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: spl_observer.c,v 1.2.2.6.2.3.2.16 2009/01/16 22:20:53 colder Exp $ */ +/* $Id: spl_observer.c,v 1.2.2.6.2.3.2.17 2009/03/19 02:45:17 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -106,6 +106,85 @@ zval_ptr_dtor(element-inf); } /* }}} */ +spl_SplObjectStorageElement* spl_object_storage_get(spl_SplObjectStorage *intern, zval *obj TSRMLS_DC) /* {{{ */ +{ + spl_SplObjectStorageElement *element; + zend_object_value *pzvalue; +#if HAVE_PACKED_OBJECT_VALUE + pzvalue = Z_OBJVAL_P(obj); +#else + zend_object_value zvalue; + memset(zvalue, 0, sizeof(zend_object_value)); + zvalue.handle = Z_OBJ_HANDLE_P(obj); + zvalue.handlers = Z_OBJ_HT_P(obj); + pzvalue = zvalue; +#endif + if (zend_hash_find(intern-storage, (char*)pzvalue, sizeof(zend_object_value), (void**)element) == SUCCESS) { + return element; + } else { + return NULL; + } +} /* }}} */ + +void spl_object_storage_attach(spl_SplObjectStorage *intern, zval *obj, zval *inf TSRMLS_DC) /* {{{ */ +{ + spl_SplObjectStorageElement *pelement, element; + pelement = spl_object_storage_get(intern, obj TSRMLS_CC); + if (inf) { + Z_ADDREF_P(inf); + } else { + ALLOC_INIT_ZVAL(inf); + } + if (pelement) { + zval_ptr_dtor(pelement-inf); + pelement-inf = inf; + return; + } + Z_ADDREF_P(obj); + element.obj = obj; + element.inf = inf; +#if HAVE_PACKED_OBJECT_VALUE + zend_hash_update(intern-storage, (char*)Z_OBJVAL_P(obj), sizeof(zend_object_value), element, sizeof(spl_SplObjectStorageElement), NULL); +#else + { + zend_object_value zvalue; + memset(zvalue, 0, sizeof(zend_object_value)); + zvalue.handle = Z_OBJ_HANDLE_P(obj); + zvalue.handlers = Z_OBJ_HT_P(obj); + zend_hash_update(intern-storage, (char*)zvalue, sizeof(zend_object_value), element, sizeof(spl_SplObjectStorageElement), NULL); + } +#endif +} /* }}} */ + +void spl_object_storage_detach(spl_SplObjectStorage *intern, zval *obj TSRMLS_DC) /* {{{ */ +{ +#if HAVE_PACKED_OBJECT_VALUE + zend_hash_del(intern-storage, (char*)Z_OBJVAL_P(obj), sizeof(zend_object_value)); +#else + { + zend_object_value zvalue; + memset(zvalue, 0, sizeof(zend_object_value)); + zvalue.handle = Z_OBJ_HANDLE_P(obj); + zvalue.handlers = Z_OBJ_HT_P(obj); + zend_hash_del(intern-storage, (char*)zvalue, sizeof(zend_object_value)); + } +#endif +} /* }}}*/ + +void spl_object_storage_addall(spl_SplObjectStorage *intern, spl_SplObjectStorage *other TSRMLS_DC) { /* {{{ */ + HashPosition pos; + spl_SplObjectStorageElement *element; + + zend_hash_internal_pointer_reset_ex(other-storage, pos); + while (zend_hash_get_current_data_ex(other-storage, (void **)element, pos) == SUCCESS) { + spl_object_storage_attach(intern, element-obj, element-inf TSRMLS_CC); + zend_hash_move_forward_ex(other-storage, pos); + } + + zend_hash_internal_pointer_reset_ex(intern-storage, intern-pos); + intern-index = 0; +} /* }}} */ + static zend_object_value spl_object_storage_new_ex(zend_class_entry *class_type, spl_SplObjectStorage **obj, zval *orig TSRMLS_DC) /* {{{ */ { zend_object_value retval; @@ -123,10 +202,35 @@ retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) spl_SplOjectStorage_free_storage, NULL TSRMLS_CC); retval.handlers = spl_handler_SplObjectStorage; + + if (orig) { + spl_SplObjectStorage *other = (spl_SplObjectStorage*)zend_object_store_get_object(orig TSRMLS_CC); + spl_object_storage_addall(intern, other TSRMLS_CC); + } + return retval; } /* }}} */ +/* {{{ spl_object_storage_clone */ +static zend_object_value spl_object_storage_clone(zval *zobject TSRMLS_DC) +{ + zend_object_value new_obj_val; + zend_object *old_object; + zend_object *new_object; +
[PHP-CVS] cvs: php-src /ext/spl/tests observer_009.phpt
colder Thu Mar 19 02:46:41 2009 UTC Added files: /php-src/ext/spl/tests observer_009.phpt Log: Add test covering for #47671 http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/observer_009.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/observer_009.phpt +++ php-src/ext/spl/tests/observer_009.phpt --TEST-- SPL: SplObjectStorage addAll/removeAll --FILE-- ?php class Foo {} $storageA = new \SplObjectStorage(); $storageA-attach(new \Foo); $storageA-attach(new \Foo); echo (Count storage A: . count($storageA)); foreach ($storageA as $object) { echo ' x '; } echo \n; $storageB = clone $storageA; echo (Count storage B: . count($storageB)); foreach ($storageB as $object) { echo ' x '; } echo \n; ? ===DONE=== ?php exit(0); ? --EXPECTF-- Count storage A: 2 x x Count storage B: 2 x x ===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_3) /ext/spl/tests observer_009.phpt
colder Thu Mar 19 02:47:00 2009 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests observer_009.phpt Log: MFH: Add test covering for #47671 http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/observer_009.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/observer_009.phpt +++ php-src/ext/spl/tests/observer_009.phpt --TEST-- SPL: SplObjectStorage addAll/removeAll --FILE-- ?php class Foo {} $storageA = new \SplObjectStorage(); $storageA-attach(new \Foo); $storageA-attach(new \Foo); echo (Count storage A: . count($storageA)); foreach ($storageA as $object) { echo ' x '; } echo \n; $storageB = clone $storageA; echo (Count storage B: . count($storageB)); foreach ($storageB as $object) { echo ' x '; } echo \n; ? ===DONE=== ?php exit(0); ? --EXPECTF-- Count storage A: 2 x x Count storage B: 2 x x ===DONE=== -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl_array.c
colder Thu Mar 19 03:00:45 2009 UTC Modified files: /php-src/ext/splspl_array.c Log: Fix #47231 (offsetGet error using incorrect offset) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.162r2=1.163diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.162 php-src/ext/spl/spl_array.c:1.163 --- php-src/ext/spl/spl_array.c:1.162 Tue Mar 10 23:39:38 2009 +++ php-src/ext/spl/spl_array.c Thu Mar 19 03:00:44 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.162 2009/03/10 23:39:38 helly Exp $ */ +/* $Id: spl_array.c,v 1.163 2009/03/19 03:00:44 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -348,7 +348,7 @@ zend_hash_index_find(ht, index, (void **) retval); return retval; } else { - zend_error(E_NOTICE, Undefined offset: %ld, Z_LVAL_P(offset)); + zend_error(E_NOTICE, Undefined offset: %ld, index); return EG(uninitialized_zval_ptr); } } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_array.c
colder Thu Mar 19 03:01:37 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_array.c /php-srcNEWS Log: MFH: Fix #47231 (offsetGet error using incorrect offset) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.38r2=1.71.2.17.2.13.2.39diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.38 php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.39 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.38 Tue Jan 27 14:50:27 2009 +++ php-src/ext/spl/spl_array.c Thu Mar 19 03:01:37 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.13.2.38 2009/01/27 14:50:27 tony2001 Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.13.2.39 2009/03/19 03:01:37 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -346,7 +346,7 @@ zend_hash_index_find(ht, index, (void **) retval); return retval; } else { - zend_error(E_NOTICE, Undefined offset: %ld, Z_LVAL_P(offset)); + zend_error(E_NOTICE, Undefined offset: %ld, index); return EG(uninitialized_zval_ptr); } } else { http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.525r2=1.2027.2.547.2.965.2.526diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.525 php-src/NEWS:1.2027.2.547.2.965.2.526 --- php-src/NEWS:1.2027.2.547.2.965.2.525 Thu Mar 19 02:45:17 2009 +++ php-src/NEWSThu Mar 19 03:01:37 2009 @@ -31,6 +31,7 @@ - Fixed bug #47320 ($php_errormsg out of scope in functions). (Dmitry) - Fixed bug #47265 (generating phar.phar fails because of safe_mode). (Greg) - Fixed bug #47243 (OCI8: Crash at shutdown on Windows) (Chris Jones/Oracle Corp.) +- Fixed bug #47231 (offsetGet error using incorrect offset). (Etienne) - Fixed bug #47229 (preg_quote() should escape the '-' char). (Nuno) - Fixed bug #47085 (rename() returns true even if the file in PHAR does not exist). (Greg) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl/examples dualiterator.inc
colder Tue Feb 3 12:40:01 2009 UTC Modified files: /php-src/ext/spl/examples dualiterator.inc Log: Fix #47031 (Fix constants in example) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/examples/dualiterator.inc?r1=1.4r2=1.5diff_format=u Index: php-src/ext/spl/examples/dualiterator.inc diff -u php-src/ext/spl/examples/dualiterator.inc:1.4 php-src/ext/spl/examples/dualiterator.inc:1.5 --- php-src/ext/spl/examples/dualiterator.inc:1.4 Sun Dec 10 23:44:35 2006 +++ php-src/ext/spl/examples/dualiterator.inc Tue Feb 3 12:40:00 2009 @@ -23,10 +23,9 @@ const KEY_LHS = 0x10; const KEY_RHS = 0x20; - const KEY_ARRAY = 0x30; const KEY_0 = 0x00; - const DEFAULT_FLAGS = 0x33; + const DEFAULT_FLAGS = 0x13; private $lhs; private $rhs; @@ -39,7 +38,7 @@ * @param flags iteration flags */ function __construct(Iterator $lhs, Iterator $rhs, - $flags = 0x33 /*DualIterator::DEFAULT_FLAGS*/) + $flags = 0x13 /*DualIterator::DEFAULT_FLAGS*/) { $this-lhs = $lhs; $this-rhs = $rhs; @@ -107,20 +106,18 @@ } } - /** @return current value depending on KEY_* flags + /** @return key value depending on KEY_* flags */ function key() { switch($this-flags 0xF0) { default: - case self::CURRENT_ARRAY: - return array($this-lhs-key(), $this-rhs-key()); - case self::CURRENT_LHS: + case self::KEY_LHS: return $this-lhs-key(); - case self::CURRENT_RHS: + case self::KEY_RHS: return $this-rhs-key(); - case self::CURRENT_0: + case self::KEY_0: 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/spl php_spl.c php_spl.h
colder Mon Jan 26 11:37:50 2009 UTC Modified files: /php-src/ext/splphp_spl.c php_spl.h Log: Improve spl_object_hash() http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.149r2=1.150diff_format=u Index: php-src/ext/spl/php_spl.c diff -u php-src/ext/spl/php_spl.c:1.149 php-src/ext/spl/php_spl.c:1.150 --- php-src/ext/spl/php_spl.c:1.149 Wed Dec 31 11:12:36 2008 +++ php-src/ext/spl/php_spl.c Mon Jan 26 11:37:46 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_spl.c,v 1.149 2008/12/31 11:12:36 sebastian Exp $ */ +/* $Id: php_spl.c,v 1.150 2009/01/26 11:37:46 colder Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -39,7 +39,9 @@ #include spl_fixedarray.h #include zend_exceptions.h #include zend_interfaces.h -#include ext/standard/md5.h +#include ext/standard/php_rand.h +#include ext/standard/php_lcg.h +#include main/snprintf.h #ifdef COMPILE_DL_SPL ZEND_GET_MODULE(spl) @@ -689,34 +691,41 @@ PHP_FUNCTION(spl_object_hash) { zval *obj; - char* md5str; + char* hash; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, o, obj) == FAILURE) { return; } - md5str = emalloc(33); - php_spl_object_hash(obj, md5str TSRMLS_CC); + hash = emalloc(33); + php_spl_object_hash(obj, hash TSRMLS_CC); - RETVAL_STRING(md5str, 0); + RETVAL_STRING(hash, 0); } /* }}} */ -PHPAPI void php_spl_object_hash(zval *obj, char *md5str TSRMLS_DC) /* {{{*/ +PHPAPI void php_spl_object_hash(zval *obj, char *result TSRMLS_DC) /* {{{*/ { - int len; - char *hash; - PHP_MD5_CTX context; - unsigned char digest[16]; - - len = spprintf(hash, 0, %p:%d, Z_OBJ_HT_P(obj), Z_OBJ_HANDLE_P(obj)); - - md5str[0] = '\0'; - PHP_MD5Init(context); - PHP_MD5Update(context, (unsigned char*)hash, len); - PHP_MD5Final(digest, context); - make_digest(md5str, digest); - efree(hash); + intptr_t hash_handle, hash_handlers; + char *hex; + + if (!SPL_G(hash_mask_init)) { + if (!BG(mt_rand_is_seeded)) { + php_mt_srand(GENERATE_SEED() TSRMLS_CC); + } + + SPL_G(hash_mask_handle) = (intptr_t)(php_mt_rand(TSRMLS_C) 1); + SPL_G(hash_mask_handlers) = (intptr_t)(php_mt_rand(TSRMLS_C) 1); + SPL_G(hash_mask_init) = 1; + } + + hash_handle = SPL_G(hash_mask_handle)^(intptr_t)Z_OBJ_HANDLE_P(obj); + hash_handlers = SPL_G(hash_mask_handlers)^(intptr_t)Z_OBJ_HT_P(obj); + + spprintf(hex, 32, %016x%016x, hash_handle, hash_handlers); + + strlcpy(result, hex, 33); + efree(hex); } /* }}} */ @@ -865,6 +874,8 @@ ZVAL_ASCII_STRINGL(SPL_G(autoload_extensions), .inc,.php, sizeof(.inc,.php)-1, 1); SPL_G(autoload_functions) = NULL; SPL_G(autoload_running) = 0; + SPL_G(autoload_running) = 0; + SPL_G(hash_mask_init) = 0; return SUCCESS; } /* }}} */ @@ -879,6 +890,9 @@ FREE_HASHTABLE(SPL_G(autoload_functions)); SPL_G(autoload_functions) = NULL; } + if (SPL_G(hash_mask_init)) { + SPL_G(hash_mask_init) = 0; + } return SUCCESS; } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.h?r1=1.28r2=1.29diff_format=u Index: php-src/ext/spl/php_spl.h diff -u php-src/ext/spl/php_spl.h:1.28 php-src/ext/spl/php_spl.h:1.29 --- php-src/ext/spl/php_spl.h:1.28 Wed Dec 31 11:12:36 2008 +++ php-src/ext/spl/php_spl.h Mon Jan 26 11:37:46 2009 @@ -61,6 +61,9 @@ zval autoload_extensions; HashTable * autoload_functions; int autoload_running; + intptr_t hash_mask_handle; + intptr_t hash_mask_handlers; + int hash_mask_init; ZEND_END_MODULE_GLOBALS(spl) #ifdef ZTS -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl php_spl.c php_spl.h
colder Mon Jan 26 11:38:03 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splphp_spl.c php_spl.h Log: MFH: Improve spl_object_hash() http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.17.2.34r2=1.52.2.28.2.17.2.35diff_format=u Index: php-src/ext/spl/php_spl.c diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.34 php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.35 --- php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.34 Wed Dec 31 11:15:43 2008 +++ php-src/ext/spl/php_spl.c Mon Jan 26 11:38:03 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_spl.c,v 1.52.2.28.2.17.2.34 2008/12/31 11:15:43 sebastian Exp $ */ +/* $Id: php_spl.c,v 1.52.2.28.2.17.2.35 2009/01/26 11:38:03 colder Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -39,7 +39,9 @@ #include spl_heap.h #include zend_exceptions.h #include zend_interfaces.h -#include ext/standard/md5.h +#include ext/standard/php_rand.h +#include ext/standard/php_lcg.h +#include main/snprintf.h #ifdef COMPILE_DL_SPL ZEND_GET_MODULE(spl) @@ -669,34 +671,41 @@ PHP_FUNCTION(spl_object_hash) { zval *obj; - char* md5str; + char* hash; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, o, obj) == FAILURE) { return; } - md5str = emalloc(33); - php_spl_object_hash(obj, md5str TSRMLS_CC); + hash = emalloc(33); + php_spl_object_hash(obj, hash TSRMLS_CC); - RETVAL_STRING(md5str, 0); + RETVAL_STRING(hash, 0); } /* }}} */ -PHPAPI void php_spl_object_hash(zval *obj, char *md5str TSRMLS_DC) /* {{{*/ +PHPAPI void php_spl_object_hash(zval *obj, char *result TSRMLS_DC) /* {{{*/ { - int len; - char *hash; - PHP_MD5_CTX context; - unsigned char digest[16]; - - len = spprintf(hash, 0, %p:%d, Z_OBJ_HT_P(obj), Z_OBJ_HANDLE_P(obj)); - - md5str[0] = '\0'; - PHP_MD5Init(context); - PHP_MD5Update(context, (unsigned char*)hash, len); - PHP_MD5Final(digest, context); - make_digest(md5str, digest); - efree(hash); + intptr_t hash_handle, hash_handlers; + char *hex; + + if (!SPL_G(hash_mask_init)) { + if (!BG(mt_rand_is_seeded)) { + php_mt_srand(GENERATE_SEED() TSRMLS_CC); + } + + SPL_G(hash_mask_handle) = (intptr_t)(php_mt_rand(TSRMLS_C) 1); + SPL_G(hash_mask_handlers) = (intptr_t)(php_mt_rand(TSRMLS_C) 1); + SPL_G(hash_mask_init) = 1; + } + + hash_handle = SPL_G(hash_mask_handle)^(intptr_t)Z_OBJ_HANDLE_P(obj); + hash_handlers = SPL_G(hash_mask_handlers)^(intptr_t)Z_OBJ_HT_P(obj); + + spprintf(hex, 32, %016x%016x, hash_handle, hash_handlers); + + strlcpy(result, hex, 33); + efree(hex); } /* }}} */ @@ -844,6 +853,7 @@ SPL_G(autoload_extensions) = NULL; SPL_G(autoload_extensions_len) = 0; SPL_G(autoload_functions) = NULL; + SPL_G(hash_mask_init) = 0; return SUCCESS; } /* }}} */ @@ -859,6 +869,9 @@ FREE_HASHTABLE(SPL_G(autoload_functions)); SPL_G(autoload_functions) = NULL; } + if (SPL_G(hash_mask_init)) { + SPL_G(hash_mask_init) = 0; + } return SUCCESS; } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.h?r1=1.17.2.1.2.3.2.6r2=1.17.2.1.2.3.2.7diff_format=u Index: php-src/ext/spl/php_spl.h diff -u php-src/ext/spl/php_spl.h:1.17.2.1.2.3.2.6 php-src/ext/spl/php_spl.h:1.17.2.1.2.3.2.7 --- php-src/ext/spl/php_spl.h:1.17.2.1.2.3.2.6 Wed Dec 31 11:15:43 2008 +++ php-src/ext/spl/php_spl.h Mon Jan 26 11:38:03 2009 @@ -62,6 +62,9 @@ HashTable * autoload_functions; int autoload_running; int autoload_extensions_len; + intptr_t hash_mask_handle; + intptr_t hash_mask_handlers; + int hash_mask_init; ZEND_END_MODULE_GLOBALS(spl) #ifdef ZTS -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/spl spl_observer.c
Hello, On Sat, Jan 17, 2009 at 9:10 PM, Marcus Boerger he...@php.net wrote: Hello Etienne, Friday, January 16, 2009, 11:20:01 PM, you wrote: colder Fri Jan 16 22:20:01 2009 UTC Modified files: /php-src/ext/splspl_observer.c Log: Implement SplObjectStorage::addAll/removeAll http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_observer.c?r1=1.31r2=1.32diff_format=u Index: php-src/ext/spl/spl_observer.c diff -u php-src/ext/spl/spl_observer.c:1.31 php-src/ext/spl/spl_observer.c:1.32 --- php-src/ext/spl/spl_observer.c:1.31 Wed Jan 14 15:51:54 2009 +++ php-src/ext/spl/spl_observer.c Fri Jan 16 22:20:00 2009 @@ -13,10 +13,11 @@ | lice...@php.net so we can mail you a copy immediately. +--+ | Authors: Marcus Boerger he...@php.net + | Etienne Kneuss col...@php.net +--+ */ -/* $Id: spl_observer.c,v 1.31 2009/01/14 15:51:54 colder Exp $ */ +/* $Id: spl_observer.c,v 1.32 2009/01/16 22:20:00 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -332,6 +333,62 @@ } } /* }}} */ +/* {{{ proto bool SplObjectStorage::addAll(SplObjectStorage $os) + Add all elements contained in $os */ +SPL_METHOD(SplObjectStorage, addAll) Can we name this copy(), to me addAll() is a pretty bad choice for what you do. Maybe we also want to add copyFromIterator() and copyFromArray() Mmmh, I thought is was a somewhat valid name, i.e. java's collection API uses addAll(Collection $o) The only problem I saw with arrays and iterators is that you can't have object = info map with both, since both array and iterator keys can't be objects. I thought about it and IMO we can always relax the argument type restriction and allow arrays and iterators if we feel the need, instead of extending the API. +{ + zval *obj; + spl_SplObjectStorage *intern = (spl_SplObjectStorage *)zend_object_store_get_object(getThis() TSRMLS_CC); + spl_SplObjectStorage *other; + spl_SplObjectStorageElement *element; + HashPosition pos; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, O, obj, spl_ce_SplObjectStorage) == FAILURE) { + return; + } + + other = (spl_SplObjectStorage *)zend_object_store_get_object(obj TSRMLS_CC); + + zend_hash_internal_pointer_reset_ex(other-storage, pos); + while (zend_hash_get_current_data_ex(other-storage, (void **)element, pos) == SUCCESS) { + spl_object_storage_attach(intern, element-obj, element-inf TSRMLS_CC); + zend_hash_move_forward_ex(other-storage, pos); + } + + zend_hash_internal_pointer_reset_ex(intern-storage, intern-pos); + intern-index = 0; + + RETURN_LONG(zend_hash_num_elements(intern-storage)); +} /* }}} */ + +/* {{{ proto bool SplObjectStorage::removeAll(SplObjectStorage $os) + Remove all elements contained in $os */ +SPL_METHOD(SplObjectStorage, removeAll) How about, excessDelete() or even better removeOverlap() because removeAll() suggests a completely different opeartion. Since it basically is the opposite of addAll, removeAll seemed adequate... Of course removeAll without argument is basically a clear(), but with the argument it seems to me like it suggests what it does... IMO we should keep some kind of naming similarity between the two methods since they are closely related. Is it the All that is bothering you ? Since we already have attach/detach, what do you think of attachAll and detachAll ? Regards +{ + zval *obj; + spl_SplObjectStorage *intern = (spl_SplObjectStorage *)zend_object_store_get_object(getThis() TSRMLS_CC); + spl_SplObjectStorage *other; + spl_SplObjectStorageElement *element; + HashPosition pos; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, O, obj, spl_ce_SplObjectStorage) == FAILURE) { + return; + } + + other = (spl_SplObjectStorage *)zend_object_store_get_object(obj TSRMLS_CC); + + zend_hash_internal_pointer_reset_ex(other-storage, pos); + while (zend_hash_get_current_data_ex(other-storage, (void **)element, pos) == SUCCESS) { + spl_object_storage_detach(intern, element-obj TSRMLS_CC); + zend_hash_move_forward_ex(other-storage, pos); + } + + zend_hash_internal_pointer_reset_ex(intern-storage, intern-pos); + intern-index = 0; + + RETURN_LONG(zend_hash_num_elements(intern-storage)); +} /* }}} */ + /* {{{ proto bool SplObjectStorage::contains($obj) U Determine whethe an object is contained in the storage */ SPL_METHOD(SplObjectStorage, contains) @@ -907,6 +964,8 @@ SPL_ME(SplObjectStorage, attach, arginfo_attach,0) SPL_ME(SplObjectStorage, detach, arginfo_Object,0
[PHP-CVS] cvs: php-src /ext/spl spl_observer.c
colder Fri Jan 16 22:20:01 2009 UTC Modified files: /php-src/ext/splspl_observer.c Log: Implement SplObjectStorage::addAll/removeAll http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_observer.c?r1=1.31r2=1.32diff_format=u Index: php-src/ext/spl/spl_observer.c diff -u php-src/ext/spl/spl_observer.c:1.31 php-src/ext/spl/spl_observer.c:1.32 --- php-src/ext/spl/spl_observer.c:1.31 Wed Jan 14 15:51:54 2009 +++ php-src/ext/spl/spl_observer.c Fri Jan 16 22:20:00 2009 @@ -13,10 +13,11 @@ | lice...@php.net so we can mail you a copy immediately. | +--+ | Authors: Marcus Boerger he...@php.net | + | Etienne Kneuss col...@php.net | +--+ */ -/* $Id: spl_observer.c,v 1.31 2009/01/14 15:51:54 colder Exp $ */ +/* $Id: spl_observer.c,v 1.32 2009/01/16 22:20:00 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -332,6 +333,62 @@ } } /* }}} */ +/* {{{ proto bool SplObjectStorage::addAll(SplObjectStorage $os) + Add all elements contained in $os */ +SPL_METHOD(SplObjectStorage, addAll) +{ + zval *obj; + spl_SplObjectStorage *intern = (spl_SplObjectStorage *)zend_object_store_get_object(getThis() TSRMLS_CC); + spl_SplObjectStorage *other; + spl_SplObjectStorageElement *element; + HashPosition pos; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, O, obj, spl_ce_SplObjectStorage) == FAILURE) { + return; + } + + other = (spl_SplObjectStorage *)zend_object_store_get_object(obj TSRMLS_CC); + + zend_hash_internal_pointer_reset_ex(other-storage, pos); + while (zend_hash_get_current_data_ex(other-storage, (void **)element, pos) == SUCCESS) { + spl_object_storage_attach(intern, element-obj, element-inf TSRMLS_CC); + zend_hash_move_forward_ex(other-storage, pos); + } + + zend_hash_internal_pointer_reset_ex(intern-storage, intern-pos); + intern-index = 0; + + RETURN_LONG(zend_hash_num_elements(intern-storage)); +} /* }}} */ + +/* {{{ proto bool SplObjectStorage::removeAll(SplObjectStorage $os) + Remove all elements contained in $os */ +SPL_METHOD(SplObjectStorage, removeAll) +{ + zval *obj; + spl_SplObjectStorage *intern = (spl_SplObjectStorage *)zend_object_store_get_object(getThis() TSRMLS_CC); + spl_SplObjectStorage *other; + spl_SplObjectStorageElement *element; + HashPosition pos; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, O, obj, spl_ce_SplObjectStorage) == FAILURE) { + return; + } + + other = (spl_SplObjectStorage *)zend_object_store_get_object(obj TSRMLS_CC); + + zend_hash_internal_pointer_reset_ex(other-storage, pos); + while (zend_hash_get_current_data_ex(other-storage, (void **)element, pos) == SUCCESS) { + spl_object_storage_detach(intern, element-obj TSRMLS_CC); + zend_hash_move_forward_ex(other-storage, pos); + } + + zend_hash_internal_pointer_reset_ex(intern-storage, intern-pos); + intern-index = 0; + + RETURN_LONG(zend_hash_num_elements(intern-storage)); +} /* }}} */ + /* {{{ proto bool SplObjectStorage::contains($obj) U Determine whethe an object is contained in the storage */ SPL_METHOD(SplObjectStorage, contains) @@ -907,6 +964,8 @@ SPL_ME(SplObjectStorage, attach, arginfo_attach,0) SPL_ME(SplObjectStorage, detach, arginfo_Object,0) SPL_ME(SplObjectStorage, contains,arginfo_Object,0) + SPL_ME(SplObjectStorage, addAll, arginfo_Object,0) + SPL_ME(SplObjectStorage, removeAll, arginfo_Object,0) SPL_ME(SplObjectStorage, getInfo, NULL, 0) SPL_ME(SplObjectStorage, setInfo, arginfo_setInfo, 0) /* Countable */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_observer.c
colder Fri Jan 16 22:20:54 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/splspl_observer.c /php-srcNEWS Log: MFH: Implement SplObjectStorage::addAll/removeAll http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_observer.c?r1=1.2.2.6.2.3.2.15r2=1.2.2.6.2.3.2.16diff_format=u Index: php-src/ext/spl/spl_observer.c diff -u php-src/ext/spl/spl_observer.c:1.2.2.6.2.3.2.15 php-src/ext/spl/spl_observer.c:1.2.2.6.2.3.2.16 --- php-src/ext/spl/spl_observer.c:1.2.2.6.2.3.2.15 Wed Jan 14 15:53:03 2009 +++ php-src/ext/spl/spl_observer.c Fri Jan 16 22:20:53 2009 @@ -13,10 +13,11 @@ | lice...@php.net so we can mail you a copy immediately. | +--+ | Authors: Marcus Boerger he...@php.net | + | Etienne Kneuss col...@php.net | +--+ */ -/* $Id: spl_observer.c,v 1.2.2.6.2.3.2.15 2009/01/14 15:53:03 colder Exp $ */ +/* $Id: spl_observer.c,v 1.2.2.6.2.3.2.16 2009/01/16 22:20:53 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -237,7 +238,6 @@ } } /* }}} */ - void spl_object_storage_attach(spl_SplObjectStorage *intern, zval *obj, zval *inf TSRMLS_DC) /* {{{ */ { spl_SplObjectStorageElement *pelement, element; @@ -332,6 +332,62 @@ } } /* }}} */ +/* {{{ proto bool SplObjectStorage::addAll(SplObjectStorage $os) + Add all elements contained in $os */ +SPL_METHOD(SplObjectStorage, addAll) +{ + zval *obj; + spl_SplObjectStorage *intern = (spl_SplObjectStorage *)zend_object_store_get_object(getThis() TSRMLS_CC); + spl_SplObjectStorage *other; + spl_SplObjectStorageElement *element; + HashPosition pos; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, O, obj, spl_ce_SplObjectStorage) == FAILURE) { + return; + } + + other = (spl_SplObjectStorage *)zend_object_store_get_object(obj TSRMLS_CC); + + zend_hash_internal_pointer_reset_ex(other-storage, pos); + while (zend_hash_get_current_data_ex(other-storage, (void **)element, pos) == SUCCESS) { + spl_object_storage_attach(intern, element-obj, element-inf TSRMLS_CC); + zend_hash_move_forward_ex(other-storage, pos); + } + + zend_hash_internal_pointer_reset_ex(intern-storage, intern-pos); + intern-index = 0; + + RETURN_LONG(zend_hash_num_elements(intern-storage)); +} /* }}} */ + +/* {{{ proto bool SplObjectStorage::removeAll(SplObjectStorage $os) + Remove all elements contained in $os */ +SPL_METHOD(SplObjectStorage, removeAll) +{ + zval *obj; + spl_SplObjectStorage *intern = (spl_SplObjectStorage *)zend_object_store_get_object(getThis() TSRMLS_CC); + spl_SplObjectStorage *other; + spl_SplObjectStorageElement *element; + HashPosition pos; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, O, obj, spl_ce_SplObjectStorage) == FAILURE) { + return; + } + + other = (spl_SplObjectStorage *)zend_object_store_get_object(obj TSRMLS_CC); + + zend_hash_internal_pointer_reset_ex(other-storage, pos); + while (zend_hash_get_current_data_ex(other-storage, (void **)element, pos) == SUCCESS) { + spl_object_storage_detach(intern, element-obj TSRMLS_CC); + zend_hash_move_forward_ex(other-storage, pos); + } + + zend_hash_internal_pointer_reset_ex(intern-storage, intern-pos); + intern-index = 0; + + RETURN_LONG(zend_hash_num_elements(intern-storage)); +} /* }}} */ + /* {{{ proto bool SplObjectStorage::contains($obj) Determine whethe an object is contained in the storage */ SPL_METHOD(SplObjectStorage, contains) @@ -618,6 +674,8 @@ SPL_ME(SplObjectStorage, attach, arginfo_attach,0) SPL_ME(SplObjectStorage, detach, arginfo_Object,0) SPL_ME(SplObjectStorage, contains,arginfo_Object,0) + SPL_ME(SplObjectStorage, addAll, arginfo_Object,0) + SPL_ME(SplObjectStorage, removeAll, arginfo_Object,0) SPL_ME(SplObjectStorage, getInfo, NULL, 0) SPL_ME(SplObjectStorage, setInfo, arginfo_setInfo, 0) /* Countable */ http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.460r2=1.2027.2.547.2.965.2.461diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.460 php-src/NEWS:1.2027.2.547.2.965.2.461 --- php-src/NEWS:1.2027.2.547.2.965.2.460 Fri Jan 16 11:31:02 2009 +++ php-src/NEWSFri Jan 16 22:20:53 2009 @@ -38,6 +38,7 @@ maximum if required. (Scott) - Added ICU support to SQLite3 when using the bundled version. (Scott) - Added pixelation support in imagefilter(). (Takeshi Abe, Kalle) +- Added SplObjectStorage
[PHP-CVS] cvs: php-src /ext/spl/tests observer_008.phpt
colder Sat Jan 17 01:30:43 2009 UTC Added files: /php-src/ext/spl/tests observer_008.phpt Log: Add tests for addAll/RemoveAll http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/observer_008.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/observer_008.phpt +++ php-src/ext/spl/tests/observer_008.phpt --TEST-- SPL: SplObjectStorage addAll/removeAll --FILE-- ?php class A extends SplObjectStorage { } $o1 = new StdClass; $o2 = new StdClass; $o3 = new StdClass; $a = new A; $a-attach($o1); $a-attach($o2); $b = new SplObjectSTorage(); $b-attach($o2); $b-attach($o3); $a-addAll($b); var_dump($a-count()); $a-detach($o3); var_dump($a-count()); $a-removeAll($b); var_dump($a-count()); ? ===DONE=== ?php exit(0); ? --EXPECTF-- int(3) int(2) int(1) ===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_3) /ext/spl/tests observer_008.phpt
colder Sat Jan 17 01:30:52 2009 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests observer_008.phpt Log: MFH: Add tests for addAll/RemoveAll http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/observer_008.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/observer_008.phpt +++ php-src/ext/spl/tests/observer_008.phpt --TEST-- SPL: SplObjectStorage addAll/removeAll --FILE-- ?php class A extends SplObjectStorage { } $o1 = new StdClass; $o2 = new StdClass; $o3 = new StdClass; $a = new A; $a-attach($o1); $a-attach($o2); $b = new SplObjectSTorage(); $b-attach($o2); $b-attach($o3); $a-addAll($b); var_dump($a-count()); $a-detach($o3); var_dump($a-count()); $a-removeAll($b); var_dump($a-count()); ? ===DONE=== ?php exit(0); ? --EXPECTF-- int(3) int(2) int(1) ===DONE=== -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl_observer.c /ext/spl/tests observer_007.phpt
colder Wed Jan 14 15:51:54 2009 UTC Added files: /php-src/ext/spl/tests observer_007.phpt Modified files: /php-src/ext/splspl_observer.c Log: Fix #47045 (Correctly compare splobjectstorages with ==) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_observer.c?r1=1.30r2=1.31diff_format=u Index: php-src/ext/spl/spl_observer.c diff -u php-src/ext/spl/spl_observer.c:1.30 php-src/ext/spl/spl_observer.c:1.31 --- php-src/ext/spl/spl_observer.c:1.30 Wed Dec 31 11:12:36 2008 +++ php-src/ext/spl/spl_observer.c Wed Jan 14 15:51:54 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_observer.c,v 1.30 2008/12/31 11:12:36 sebastian Exp $ */ +/* $Id: spl_observer.c,v 1.31 2009/01/14 15:51:54 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -169,6 +169,31 @@ } /* }}} */ +static int spl_object_storage_compare_info(spl_SplObjectStorageElement *e1, spl_SplObjectStorageElement *e2 TSRMLS_DC) /* {{{ */ +{ + zval result; + + if (compare_function(result, e1-inf, e2-inf TSRMLS_CC) == FAILURE) { + return 1; + } + + return Z_LVAL(result); +} +/* }}} */ + +static int spl_object_storage_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ +{ + zend_object *zo1 = (zend_object *)zend_object_store_get_object(o1 TSRMLS_CC); + zend_object *zo2 = (zend_object *)zend_object_store_get_object(o2 TSRMLS_CC); + + if (zo1-ce != spl_ce_SplObjectStorage || zo2-ce != spl_ce_SplObjectStorage) { + return 1; + } + + return zend_hash_compare(((spl_SplObjectStorage *)zo1)-storage, ((spl_SplObjectStorage *)zo2)-storage, (compare_func_t) spl_object_storage_compare_info, 0 TSRMLS_CC); +} +/* }}} */ + /* {{{ spl_array_object_new */ static zend_object_value spl_SplObjectStorage_new(zend_class_entry *class_type TSRMLS_DC) { @@ -911,7 +936,9 @@ REGISTER_SPL_STD_CLASS_EX(SplObjectStorage, spl_SplObjectStorage_new, spl_funcs_SplObjectStorage); memcpy(spl_handler_SplObjectStorage, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); - spl_handler_SplObjectStorage.get_debug_info = spl_object_storage_debug_info; + + spl_handler_SplObjectStorage.get_debug_info = spl_object_storage_debug_info; + spl_handler_SplObjectStorage.compare_objects = spl_object_storage_compare_objects; REGISTER_SPL_IMPLEMENTS(SplObjectStorage, Countable); REGISTER_SPL_IMPLEMENTS(SplObjectStorage, Iterator); http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/observer_007.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/observer_007.phpt +++ php-src/ext/spl/tests/observer_007.phpt --TEST-- SPL: SplObjectStorage comapred with == --FILE-- ?php $a = new SplObjectStorage; $b = new SplObjectStorage; var_dump($a == $b); $b[$b] = 2; var_dump($a == $b); $a[$b] = 2; var_dump($a == $b); $a[$b] = 3; var_dump($a == $b); ? ===DONE=== ?php exit(0); ? --EXPECTF-- bool(true) bool(false) bool(true) bool(false) ===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_3) / NEWS /ext/spl spl_observer.c /ext/spl/tests observer_007.phpt
colder Wed Jan 14 15:53:04 2009 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests observer_007.phpt Modified files: /php-src/ext/splspl_observer.c /php-srcNEWS Log: MFH: Fix #47045 (Correctly compare splobjectstorages with ==) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_observer.c?r1=1.2.2.6.2.3.2.14r2=1.2.2.6.2.3.2.15diff_format=u Index: php-src/ext/spl/spl_observer.c diff -u php-src/ext/spl/spl_observer.c:1.2.2.6.2.3.2.14 php-src/ext/spl/spl_observer.c:1.2.2.6.2.3.2.15 --- php-src/ext/spl/spl_observer.c:1.2.2.6.2.3.2.14 Wed Dec 31 11:15:44 2008 +++ php-src/ext/spl/spl_observer.c Wed Jan 14 15:53:03 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_observer.c,v 1.2.2.6.2.3.2.14 2008/12/31 11:15:44 sebastian Exp $ */ +/* $Id: spl_observer.c,v 1.2.2.6.2.3.2.15 2009/01/14 15:53:03 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -169,6 +169,31 @@ } /* }}} */ +static int spl_object_storage_compare_info(spl_SplObjectStorageElement *e1, spl_SplObjectStorageElement *e2 TSRMLS_DC) /* {{{ */ +{ + zval result; + + if (compare_function(result, e1-inf, e2-inf TSRMLS_CC) == FAILURE) { + return 1; + } + + return Z_LVAL(result); +} +/* }}} */ + +static int spl_object_storage_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ +{ + zend_object *zo1 = (zend_object *)zend_object_store_get_object(o1 TSRMLS_CC); + zend_object *zo2 = (zend_object *)zend_object_store_get_object(o2 TSRMLS_CC); + + if (zo1-ce != spl_ce_SplObjectStorage || zo2-ce != spl_ce_SplObjectStorage) { + return 1; + } + + return zend_hash_compare(((spl_SplObjectStorage *)zo1)-storage, ((spl_SplObjectStorage *)zo2)-storage, (compare_func_t) spl_object_storage_compare_info, 0 TSRMLS_CC); +} +/* }}} */ + /* {{{ spl_array_object_new */ static zend_object_value spl_SplObjectStorage_new(zend_class_entry *class_type TSRMLS_DC) { @@ -910,7 +935,9 @@ REGISTER_SPL_STD_CLASS_EX(SplObjectStorage, spl_SplObjectStorage_new, spl_funcs_SplObjectStorage); memcpy(spl_handler_SplObjectStorage, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); - spl_handler_SplObjectStorage.get_debug_info = spl_object_storage_debug_info; + + spl_handler_SplObjectStorage.get_debug_info = spl_object_storage_debug_info; + spl_handler_SplObjectStorage.compare_objects = spl_object_storage_compare_objects; REGISTER_SPL_IMPLEMENTS(SplObjectStorage, Countable); REGISTER_SPL_IMPLEMENTS(SplObjectStorage, Iterator); http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.456r2=1.2027.2.547.2.965.2.457diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.456 php-src/NEWS:1.2027.2.547.2.965.2.457 --- php-src/NEWS:1.2027.2.547.2.965.2.456 Wed Jan 14 13:57:41 2009 +++ php-src/NEWSWed Jan 14 15:53:03 2009 @@ -41,6 +41,7 @@ - Fixed building of pdo_sqlite without sqlite3. (Scott) - Fixed bug #47050 (mysqli_poll() modifies improper variables). (Johannes) +- Fixed bug #47045 (SplObjectStorage instances compared with ==). (Etienne) - Fixed bug #46979 (use with non-compound name *has* effect). (Dmitry) - Fixed bug #46957 (The tokenizer returns deprecated values). (Felipe) - Fixed bug #46944 (UTF-8 characters outside the BMP aren't encoded correctly). http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/observer_007.phpt?view=markuprev=1.1 Index: php-src/ext/spl/tests/observer_007.phpt +++ php-src/ext/spl/tests/observer_007.phpt --TEST-- SPL: SplObjectStorage comapred with == --FILE-- ?php $a = new SplObjectStorage; $b = new SplObjectStorage; var_dump($a == $b); $b[$b] = 2; var_dump($a == $b); $a[$b] = 2; var_dump($a == $b); $a[$b] = 3; var_dump($a == $b); ? ===DONE=== ?php exit(0); ? --EXPECTF-- bool(true) bool(false) bool(true) bool(false) ===DONE=== -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl_array.c /ext/spl/tests array_018.phpt
colder Tue Dec 30 23:32:50 2008 UTC Modified files: /php-src/ext/splspl_array.c /php-src/ext/spl/tests array_018.phpt Log: Fix #45820 (Empty ArrayObject keys not allowed) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.159r2=1.160diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.159 php-src/ext/spl/spl_array.c:1.160 --- php-src/ext/spl/spl_array.c:1.159 Wed Nov 19 17:54:24 2008 +++ php-src/ext/spl/spl_array.c Tue Dec 30 23:32:50 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.159 2008/11/19 17:54:24 lbarnaud Exp $ */ +/* $Id: spl_array.c,v 1.160 2008/12/30 23:32:50 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -436,11 +436,6 @@ switch(Z_TYPE_P(offset)) { case IS_STRING: case IS_UNICODE: - /* FIXME: Unicode support??? */ - if (Z_STRVAL_P(offset)[0] == '\0') { - zend_throw_exception(spl_ce_InvalidArgumentException, An offset must not begin with \\0 or be empty, 0 TSRMLS_CC); - return; - } Z_ADDREF_P(value); zend_u_symtable_update(spl_array_get_hash_table(intern, 0 TSRMLS_CC), Z_TYPE_P(offset), Z_UNIVAL_P(offset), Z_UNILEN_P(offset)+1, (void**)value, sizeof(void*), NULL); return; @@ -1712,7 +1707,7 @@ } if (buf_len == 0) { - zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, Empty serialized string cannot be empty); + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, Serialized string cannot be empty); return; } http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/array_018.phpt?r1=1.4r2=1.5diff_format=u Index: php-src/ext/spl/tests/array_018.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/spl spl_array.c /ext/spl/tests array_018.phpt
colder Tue Dec 30 23:34:29 2008 UTC Modified files: (Branch: PHP_5_3) /php-srcNEWS /php-src/ext/splspl_array.c /php-src/ext/spl/tests array_018.phpt Log: MFH: Fix #45820 (Empty ArrayObject keys not allowed) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.427r2=1.2027.2.547.2.965.2.428diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.427 php-src/NEWS:1.2027.2.547.2.965.2.428 --- php-src/NEWS:1.2027.2.547.2.965.2.427 Mon Dec 29 09:58:18 2008 +++ php-src/NEWSTue Dec 30 23:34:29 2008 @@ -33,6 +33,7 @@ (Scott) - Fixed bug #45989 (json_decode() doesn't return NULL on certain invalid strings). (magicaltux, Scott) +- Fixed bug #45820 (Allow empty keys in ArrayObject). (Etienne) - Fixed bug #45791 (json_decode() doesn't convert 0e0 to a double). (Scott) 04 Dec 2008, PHP 5.3.0 Alpha 3 http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.35r2=1.71.2.17.2.13.2.36diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.35 php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.36 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.35 Wed Nov 19 17:53:47 2008 +++ php-src/ext/spl/spl_array.c Tue Dec 30 23:34:29 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.13.2.35 2008/11/19 17:53:47 lbarnaud Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.13.2.36 2008/12/30 23:34:29 colder Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -433,10 +433,6 @@ } switch(Z_TYPE_P(offset)) { case IS_STRING: - if (*Z_STRVAL_P(offset) == '\0') { - zend_throw_exception(spl_ce_InvalidArgumentException, An offset must not begin with \\0 or be empty, 0 TSRMLS_CC); - return; - } Z_ADDREF_P(value); zend_symtable_update(spl_array_get_hash_table(intern, 0 TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)value, sizeof(void*), NULL); return; http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/array_018.phpt?r1=1.1.2.2.4.2r2=1.1.2.2.4.3diff_format=u Index: php-src/ext/spl/tests/array_018.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl_directory.c ZendEngine2 zend_closures.c zend_interfaces.c zend_interfaces.h
colder Mon Dec 22 13:50:43 2008 UTC Modified files: /ZendEngine2zend_closures.c zend_interfaces.c zend_interfaces.h /php-src/ext/splspl_directory.c Log: Fix #46646 (Implement zend functions to restrict serialization or internal classes) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_closures.c?r1=1.15r2=1.16diff_format=u Index: ZendEngine2/zend_closures.c diff -u ZendEngine2/zend_closures.c:1.15 ZendEngine2/zend_closures.c:1.16 --- ZendEngine2/zend_closures.c:1.15Thu Nov 27 19:02:44 2008 +++ ZendEngine2/zend_closures.c Mon Dec 22 13:50:43 2008 @@ -17,11 +17,12 @@ +--+ */ -/* $Id: zend_closures.c,v 1.15 2008/11/27 19:02:44 dmitry Exp $ */ +/* $Id: zend_closures.c,v 1.16 2008/12/22 13:50:43 colder Exp $ */ #include zend.h #include zend_API.h #include zend_closures.h +#include zend_interfaces.h #include zend_objects.h #include zend_objects_API.h #include zend_globals.h @@ -78,20 +79,6 @@ } /* }}} */ -static int zend_closure_serialize(zval *object, int *type, zstr *buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */ -{ - zend_error(E_RECOVERABLE_ERROR, Serialization of 'Closure' is not allowed); - return FAILURE; -} -/* }}} */ - -static int zend_closure_unserialize(zval **object, zend_class_entry *ce, int type, const zstr buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */ -{ - zend_error(E_RECOVERABLE_ERROR, Unserialization of 'Closure' is not allowed); - return FAILURE; -} -/* }}} */ - static int zend_closure_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ { return (Z_OBJ_HANDLE_P(o1) != Z_OBJ_HANDLE_P(o2)); @@ -247,8 +234,8 @@ zend_ce_closure = zend_register_internal_class(ce TSRMLS_CC); zend_ce_closure-ce_flags |= ZEND_ACC_FINAL_CLASS; zend_ce_closure-create_object = zend_closure_new; - zend_ce_closure-serialize = zend_closure_serialize; - zend_ce_closure-unserialize = zend_closure_unserialize; + zend_ce_closure-serialize = zend_class_serialize_deny; + zend_ce_closure-unserialize = zend_class_unserialize_deny; memcpy(closure_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); closure_handlers.get_constructor = zend_closure_get_constructor; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_interfaces.c?r1=1.74r2=1.75diff_format=u Index: ZendEngine2/zend_interfaces.c diff -u ZendEngine2/zend_interfaces.c:1.74 ZendEngine2/zend_interfaces.c:1.75 --- ZendEngine2/zend_interfaces.c:1.74 Thu Nov 27 19:02:44 2008 +++ ZendEngine2/zend_interfaces.c Mon Dec 22 13:50:43 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: zend_interfaces.c,v 1.74 2008/11/27 19:02:44 dmitry Exp $ */ +/* $Id: zend_interfaces.c,v 1.75 2008/12/22 13:50:43 colder Exp $ */ #include zend.h #include zend_API.h @@ -471,6 +471,19 @@ } /* }}} */ +ZEND_API int zend_class_serialize_deny(zval *object, int *type, zstr *buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */ +{ + zend_class_entry *ce = Z_OBJCE_P(object); + zend_throw_exception_ex(NULL, 0 TSRMLS_CC, Serialization of '%s' is not allowed, ce-name); + return FAILURE; +} /* }}} */ + +ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, int type, const zstr buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */ +{ + zend_throw_exception_ex(NULL, 0 TSRMLS_CC, Unserialization of '%s' is not allowed, ce-name); + return FAILURE; +} /* }}} */ + /* {{{ zend_implement_serializable */ static int zend_implement_serializable(zend_class_entry *interface, zend_class_entry *class_type TSRMLS_DC) { http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_interfaces.h?r1=1.24r2=1.25diff_format=u Index: ZendEngine2/zend_interfaces.h diff -u ZendEngine2/zend_interfaces.h:1.24 ZendEngine2/zend_interfaces.h:1.25 --- ZendEngine2/zend_interfaces.h:1.24 Sun Aug 24 17:01:22 2008 +++ ZendEngine2/zend_interfaces.h Mon Dec 22 13:50:43 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: zend_interfaces.h,v 1.24 2008/08/24 17:01:22 colder Exp $ */ +/* $Id: zend_interfaces.h,v 1.25 2008/12/22 13:50:43 colder Exp $ */ #ifndef ZEND_INTERFACES_H #define ZEND_INTERFACES_H @@ -69,6 +69,9 @@ ZEND_API int zend_user_serialize(zval *object, int *type, zstr *buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC); ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, int type, const zstr buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC); +ZEND_API int zend_class_serialize_deny(zval *object, int *type, zstr *buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC); +ZEND_API int zend_class_unserialize_deny(zval **object,
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/spl spl_directory.c ZendEngine2 zend_closures.c zend_interfaces.c zend_interfaces.h
colder Mon Dec 22 14:11:50 2008 UTC Modified files: (Branch: PHP_5_3) /ZendEngine2zend_closures.c zend_interfaces.c zend_interfaces.h /php-src/ext/splspl_directory.c Log: MFH: Fix #46646 (Implement zend functions to restrict serialization or internal classes) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_closures.c?r1=1.3.2.15r2=1.3.2.16diff_format=u Index: ZendEngine2/zend_closures.c diff -u ZendEngine2/zend_closures.c:1.3.2.15 ZendEngine2/zend_closures.c:1.3.2.16 --- ZendEngine2/zend_closures.c:1.3.2.15Thu Nov 27 19:01:19 2008 +++ ZendEngine2/zend_closures.c Mon Dec 22 14:11:49 2008 @@ -17,11 +17,12 @@ +--+ */ -/* $Id: zend_closures.c,v 1.3.2.15 2008/11/27 19:01:19 dmitry Exp $ */ +/* $Id: zend_closures.c,v 1.3.2.16 2008/12/22 14:11:49 colder Exp $ */ #include zend.h #include zend_API.h #include zend_closures.h +#include zend_interfaces.h #include zend_objects.h #include zend_objects_API.h #include zend_globals.h @@ -79,20 +80,6 @@ } /* }}} */ -static int zend_closure_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */ -{ - zend_error(E_RECOVERABLE_ERROR, Serialization of 'Closure' is not allowed); - return FAILURE; -} -/* }}} */ - -static int zend_closure_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */ -{ - zend_error(E_RECOVERABLE_ERROR, Unserialization of 'Closure' is not allowed); - return FAILURE; -} -/* }}} */ - static int zend_closure_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ { return (Z_OBJ_HANDLE_P(o1) != Z_OBJ_HANDLE_P(o2)); @@ -243,8 +230,8 @@ zend_ce_closure = zend_register_internal_class(ce TSRMLS_CC); zend_ce_closure-ce_flags |= ZEND_ACC_FINAL_CLASS; zend_ce_closure-create_object = zend_closure_new; - zend_ce_closure-serialize = zend_closure_serialize; - zend_ce_closure-unserialize = zend_closure_unserialize; + zend_ce_closure-serialize = zend_class_serialize_deny; + zend_ce_closure-unserialize = zend_class_unserialize_deny; memcpy(closure_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); closure_handlers.get_constructor = zend_closure_get_constructor; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_interfaces.c?r1=1.33.2.4.2.6.2.10r2=1.33.2.4.2.6.2.11diff_format=u Index: ZendEngine2/zend_interfaces.c diff -u ZendEngine2/zend_interfaces.c:1.33.2.4.2.6.2.10 ZendEngine2/zend_interfaces.c:1.33.2.4.2.6.2.11 --- ZendEngine2/zend_interfaces.c:1.33.2.4.2.6.2.10 Thu Nov 27 19:01:19 2008 +++ ZendEngine2/zend_interfaces.c Mon Dec 22 14:11:49 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: zend_interfaces.c,v 1.33.2.4.2.6.2.10 2008/11/27 19:01:19 dmitry Exp $ */ +/* $Id: zend_interfaces.c,v 1.33.2.4.2.6.2.11 2008/12/22 14:11:49 colder Exp $ */ #include zend.h #include zend_API.h @@ -463,6 +463,21 @@ } /* }}} */ +ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */ +{ + zend_class_entry *ce = Z_OBJCE_P(object); + zend_throw_exception_ex(NULL, 0 TSRMLS_CC, Serialization of '%s' is not allowed, ce-name); + return FAILURE; +} +/* }}} */ + +ZEND_API int zend_class_unserialize_deny(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */ +{ + zend_throw_exception_ex(NULL, 0 TSRMLS_CC, Unserialization of '%s' is not allowed, ce-name); + return FAILURE; +} +/* }}} */ + /* {{{ zend_implement_serializable */ static int zend_implement_serializable(zend_class_entry *interface, zend_class_entry *class_type TSRMLS_DC) { http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_interfaces.h?r1=1.11.2.1.2.2.2.2r2=1.11.2.1.2.2.2.3diff_format=u Index: ZendEngine2/zend_interfaces.h diff -u ZendEngine2/zend_interfaces.h:1.11.2.1.2.2.2.2 ZendEngine2/zend_interfaces.h:1.11.2.1.2.2.2.3 --- ZendEngine2/zend_interfaces.h:1.11.2.1.2.2.2.2 Sun Aug 24 18:22:33 2008 +++ ZendEngine2/zend_interfaces.h Mon Dec 22 14:11:49 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: zend_interfaces.h,v 1.11.2.1.2.2.2.2 2008/08/24 18:22:33 colder Exp $ */ +/* $Id: zend_interfaces.h,v 1.11.2.1.2.2.2.3 2008/12/22 14:11:49 colder Exp $ */ #ifndef ZEND_INTERFACES_H #define ZEND_INTERFACES_H @@ -64,6 +64,9 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC); ZEND_API int zend_user_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS
colder Mon Dec 22 14:19:47 2008 UTC Modified files: (Branch: PHP_5_3) /php-srcNEWS Log: MFH: Fix #46646 (Implement zend functions to restrict serialization or internal classes) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.421r2=1.2027.2.547.2.965.2.422diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.421 php-src/NEWS:1.2027.2.547.2.965.2.422 --- php-src/NEWS:1.2027.2.547.2.965.2.421 Mon Dec 22 13:24:47 2008 +++ php-src/NEWSMon Dec 22 14:19:47 2008 @@ -21,6 +21,8 @@ given bad data). (Ilia) - Fixed bug #46738 (Segfault when mb_detect_encoding() fails). (Scott) - Fixed bug #46681 (mkdir() fails silently on PHP 5.3). (Hannes) +- Fixed bug #46646 (Restrict serialization on some internal classes like + Closure and SplFileInfo using exceptions). (Etienne) - Fixed bug #46268 (DateTime::modify() does not reset relative time values). (Derick) - Fixed bug #45989 (json_decode() doesn't return NULL on certain -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard file.c
colder Sat Dec 20 00:51:00 2008 UTC Modified files: /php-src/ext/standard file.c Log: Fix #46636 (segfault in SplFileinfo::fgetcsv()) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.533r2=1.534diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.533 php-src/ext/standard/file.c:1.534 --- php-src/ext/standard/file.c:1.533 Fri Dec 12 12:40:58 2008 +++ php-src/ext/standard/file.c Sat Dec 20 00:51:00 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.533 2008/12/12 12:40:58 bjori Exp $ */ +/* $Id: file.c,v 1.534 2008/12/20 00:51:00 colder Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -2265,7 +2265,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape, size_t buf_len, char *buf, zval *return_value TSRMLS_DC) /* {{{ */ { - char *delim = delimiter, *enc = enclosure, *buffer = buf, *esc; + char *delim = delimiter, *enc = enclosure, *buffer = buf, *esc = escape; int delim_len = 1, enc_len = 1, esc_len = 1, buffer_len = buf_len; zend_uchar type = IS_STRING; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / NEWS
colder Sat Dec 20 00:53:21 2008 UTC Modified files: /php-srcNEWS Log: Fix #46647 (segfault in SplFileinfo::fgetcsv()) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2176r2=1.2177diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2176 php-src/NEWS:1.2177 --- php-src/NEWS:1.2176 Tue Dec 9 10:21:53 2008 +++ php-src/NEWSSat Dec 20 00:53:21 2008 @@ -44,4 +44,5 @@ - Added shm_has_var() function. (Mike) - Fixed bug #40325 (Vary: header missing in gzip output handlers). (Mike) +- Fixed bug #46647 (SplFileObject::fgetcsv segfaults). (Etienne) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date php_date.c /ext/dom attr.c cdatasection.c comment.c document.c documentfragment.c element.c entityreference.c processinginstruction.c text.c xpath.c /ext/mysqli mysq
colder Wed Nov 19 01:59:08 2008 UTC Added files: /ZendEngine2/tests bug46241.phpt Modified files: /ZendEngine2zend_execute_API.c zend_vm_def.h zend_vm_execute.h /ZendEngine2/tests bug46196.phpt /php-src/ext/date php_date.c /php-src/ext/domattr.c cdatasection.c comment.c document.c documentfragment.c element.c entityreference.c processinginstruction.c text.c xpath.c /php-src/ext/mysqli mysqli_driver.c /php-src/ext/simplexml simplexml.c /php-src/ext/splspl_array.c spl_directory.c spl_iterators.c spl_observer.c /php-src/ext/sqlite sqlite.c /php-src/ext/sqlite3sqlite3.c Log: Fix #46241 (stacked error_handlers, error_handling in general) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.466r2=1.467diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.466 ZendEngine2/zend_execute_API.c:1.467 --- ZendEngine2/zend_execute_API.c:1.466Thu Oct 2 19:53:48 2008 +++ ZendEngine2/zend_execute_API.c Wed Nov 19 01:59:06 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend_execute_API.c,v 1.466 2008/10/02 19:53:48 colder Exp $ */ +/* $Id: zend_execute_API.c,v 1.467 2008/11/19 01:59:06 colder Exp $ */ #include stdio.h #include signal.h @@ -956,14 +956,11 @@ EG(opline_ptr) = original_opline_ptr; } else if (EX(function_state).function-type == ZEND_INTERNAL_FUNCTION) { int call_via_handler = (EX(function_state).function-common.fn_flags ZEND_ACC_CALL_VIA_HANDLER) != 0; - zend_error_handling error_handling; - zend_save_error_handling(error_handling TSRMLS_CC); ALLOC_INIT_ZVAL(*fci-retval_ptr_ptr); if (EX(function_state).function-common.scope) { EG(scope) = EX(function_state).function-common.scope; } ((zend_internal_function *) EX(function_state).function)-handler(fci-param_count, *fci-retval_ptr_ptr, fci-retval_ptr_ptr, (fci-object_pp?*fci-object_pp:NULL), 1 TSRMLS_CC); - zend_restore_error_handling(error_handling TSRMLS_CC); /* We shouldn't fix bad extensions here, because it can break proper ones (Bug #34045) if (!EX(function_state).function-common.return_reference) @@ -984,10 +981,7 @@ /* Not sure what should be done here if it's a static method */ if (fci-object_pp) { - zend_error_handling error_handling; - zend_save_error_handling(error_handling TSRMLS_CC); Z_OBJ_HT_PP(fci-object_pp)-call_method(EX(function_state).function-common.function_name, fci-param_count, *fci-retval_ptr_ptr, fci-retval_ptr_ptr, *fci-object_pp, 1 TSRMLS_CC); - zend_restore_error_handling(error_handling TSRMLS_CC); } else { zend_error_noreturn(E_ERROR, Cannot call overloaded function for non-object); } http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.247r2=1.248diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.247 ZendEngine2/zend_vm_def.h:1.248 --- ZendEngine2/zend_vm_def.h:1.247 Mon Oct 6 00:35:19 2008 +++ ZendEngine2/zend_vm_def.h Wed Nov 19 01:59:07 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: zend_vm_def.h,v 1.247 2008/10/06 00:35:19 felipe Exp $ */ +/* $Id: zend_vm_def.h,v 1.248 2008/11/19 01:59:07 colder Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -2342,7 +2342,6 @@ EX(function_state).arguments = zend_vm_stack_push_args(opline-extended_value TSRMLS_CC); if (EX(function_state).function-type == ZEND_INTERNAL_FUNCTION) { - zend_error_handling error_handling; ALLOC_INIT_ZVAL(EX_T(opline-result.u.var).var.ptr); EX_T(opline-result.u.var).var.ptr_ptr = EX_T(opline-result.u.var).var.ptr; EX_T(opline-result.u.var).var.fcall_returned_reference = EX(function_state).function-common.return_reference; @@ -2357,14 +2356,12 @@ arg_count--; } } - zend_save_error_handling(error_handling TSRMLS_CC); if (!zend_execute_internal) { /* saves one function call if zend_execute_internal is not used */ ((zend_internal_function *) EX(function_state).function)-handler(opline-extended_value, EX_T(opline-result.u.var).var.ptr, EX_T(opline-result.u.var).var.ptr, EX(object),