|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-01-01 11:07 UTC] eero at volotinen dot com
Description: ------------ Latest build breaks phpbb2 forum. Expected result: ---------------- Phpbb2 does not show anything. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 15:00:02 2025 UTC |
can you test the simple script below.. - line 27 appears to be the class definition line. test it with php -l test.php (eg. syntax test it.) .. if this works, go back to the mysql.php file, and remove chunks. (eg. methods) and syntax test it - narrowing down the problem. <?php if(!defined("SQL_LAYER")) { define("SQL_LAYER","mysql"); class sql_db { var $test; } } // end if..Used this test script: <?php if(!defined("SQL_LAYER")) { define("SQL_LAYER","mysql"); class sql_db { var $test; } } // end if.. ?> Php reports error at line 7 which starts : class sql_db ..This appears to fix the nesting class without affecting conditional definitions. Index: zend_compile.c =================================================================== RCS file: /repository/ZendEngine2/zend_compile.c,v retrieving revision 1.507 diff -u -r1.507 zend_compile.c --- zend_compile.c 3 Jan 2004 13:51:01 -0000 1.507 +++ zend_compile.c 5 Jan 2004 09:03:04 -0000 @@ -2315,6 +2315,11 @@ int doing_inheritance = 0; zend_class_entry *new_class_entry = emalloc(sizeof(zend_class_entry)); char *lcname = zend_str_tolower_dup(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len); + + if (CG(active_class_entry) != NULL) { + efree(lcname); + zend_error(E_COMPILE_ERROR, "Cannot use nest class definitions"); + } if (!(strcmp(lcname, "self") && strcmp(lcname, "parent"))) { efree(lcname); Index: zend_language_parser.y =================================================================== RCS file: /repository/ZendEngine2/zend_language_parser.y,v retrieving revision 1.132 diff -u -r1.132 zend_language_parser.y --- zend_language_parser.y 27 Dec 2003 22:59:49 -0000 1.132 +++ zend_language_parser.y 5 Jan 2004 09:03:05 -0000 @@ -168,7 +168,9 @@ inner_statement: statement + | function_declaration_statement + | class_declaration_statement ;The patch has a memleak and does not work correct. Please try the following code: php -r 'if (1) {class a{const x=1;static function f(){return 1;}}}else{class a{const x=0;static function f(){return 0;}}}echo a::x.a::f()."\n";' php -r 'if (0) {class a{const x=1;static function f(){return 1;}}}else{class a{const x=0;static function f(){return 0;}}}echo a::x.a::f()."\n";' Both print '00' but the first should obviously print '11'Works ok here :) it will leak memory (as it doesnt free the newly declared class).. but since it fatal errors out anyway - it should be cleared up on exit ????? alan@alan:/tmp$ php5 -r 'if (1) {class a{const x=1;static function f(){return 1;}}}else{class a{const x=0;static function f(){return 0;}}}echo a::x.a::f()."\n";' 11 alan@alan:/tmp$ php5 -r 'if (0) {class a{const x=1;static function f(){return 1;}}}else{class a{const x=0;static function f(){return 0;}}}echo a::x.a::f()."\n";' 00it appears the result is dependant on CR's This produces 11 <?php if (1) { class a{const x=1;static function f(){return 1;}} } else {class a{const x=0;static function f(){return 0;}}} echo a::x.a::f()."\n"; This produces 00 <?php if (1) { class a{const x=1;static function f(){return 1;}}} else {class a{const x=0;static function f(){return 0;}}} echo a::x.a::f()."\n"; CR before } else {php -r ' if (1) { function test () { echo "1"; }} else { function test() { echo "0"; }} test();' There is another bug here.. - the above all in one line will echo 0!)