cvs: ZendEngine2 / zend_compile.c zend_compile.h zend_language_scanner.l

From: Date: Tue, 07 Jun 2005 18:11:58 +0000
Subject: cvs: ZendEngine2 / zend_compile.c zend_compile.h zend_language_scanner.l
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3752@lists.php.net to get a copy of this message
dmitry Tue Jun 7 14:11:58 2005 EDT Modified files: /ZendEngine2 zend_compile.c zend_compile.h zend_language_scanner.l Log: Fixed bug #26456 (Wrong results from Reflection-API getDocComment() when called via STDIN) http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?r1=1.629&r2=1.630&ty=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.629 ZendEngine2/zend_compile.c:1.630 --- ZendEngine2/zend_compile.c:1.629 Mon Jun 6 07:20:46 2005 +++ ZendEngine2/zend_compile.c Tue Jun 7 14:11:56 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.629 2005/06/06 11:20:46 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.630 2005/06/07 18:11:56 dmitry Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -1155,9 +1155,10 @@ } if (CG(doc_comment)) { - CG(active_op_array)->doc_comment = estrndup(CG(doc_comment), CG(doc_comment_len)); + CG(active_op_array)->doc_comment = CG(doc_comment); CG(active_op_array)->doc_comment_len = CG(doc_comment_len); - RESET_DOC_COMMENT(); + CG(doc_comment) = NULL; + CG(doc_comment_len) = 0; } } @@ -2611,9 +2612,10 @@ CG(implementing_class) = opline->result; if (CG(doc_comment)) { - CG(active_class_entry)->doc_comment = estrndup(CG(doc_comment), CG(doc_comment_len)); + CG(active_class_entry)->doc_comment = CG(doc_comment); CG(active_class_entry)->doc_comment_len = CG(doc_comment_len); - RESET_DOC_COMMENT(); + CG(doc_comment) = NULL; + CG(doc_comment_len) = 0; } } @@ -2745,9 +2747,10 @@ } if (CG(doc_comment)) { - comment = estrndup(CG(doc_comment), CG(doc_comment_len)); + comment = CG(doc_comment); comment_len = CG(doc_comment_len); - RESET_DOC_COMMENT(); + CG(doc_comment) = NULL; + CG(doc_comment_len) = 0; } zend_declare_property_ex(CG(active_class_entry), var_name->u.constant.value.str.val, var_name->u.constant.value.str.len, property, access_type, comment, comment_len TSRMLS_CC); http://cvs.php.net/diff.php/ZendEngine2/zend_compile.h?r1=1.306&r2=1.307&ty=u Index: ZendEngine2/zend_compile.h diff -u ZendEngine2/zend_compile.h:1.306 ZendEngine2/zend_compile.h:1.307 --- ZendEngine2/zend_compile.h:1.306 Sat Jun 4 12:16:18 2005 +++ ZendEngine2/zend_compile.h Tue Jun 7 14:11:56 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.h,v 1.306 2005/06/04 16:16:18 zeev Exp $ */ +/* $Id: zend_compile.h,v 1.307 2005/06/07 18:11:56 dmitry Exp $ */ #ifndef ZEND_COMPILE_H #define ZEND_COMPILE_H @@ -40,10 +40,13 @@ #define DEC_BPC(op_array) if (CG(interactive)) { ((op_array)->backpatch_count--); } #define HANDLE_INTERACTIVE() if (CG(interactive)) { execute_new_code(TSRMLS_C); } -#define RESET_DOC_COMMENT() \ - { \ - CG(doc_comment) = NULL; \ - CG(doc_comment_len) = 0; \ +#define RESET_DOC_COMMENT() \ + { \ + if (CG(doc_comment)) { \ + efree(CG(doc_comment)); \ + CG(doc_comment) = NULL; \ + } \ + CG(doc_comment_len) = 0; \ } typedef struct _zend_op_array zend_op_array; http://cvs.php.net/diff.php/ZendEngine2/zend_language_scanner.l?r1=1.126&r2=1.127&ty=u Index: ZendEngine2/zend_language_scanner.l diff -u ZendEngine2/zend_language_scanner.l:1.126 ZendEngine2/zend_language_scanner.l:1.127 --- ZendEngine2/zend_language_scanner.l:1.126 Sun Jun 5 21:51:48 2005 +++ ZendEngine2/zend_language_scanner.l Tue Jun 7 14:11:56 2005 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_scanner.l,v 1.126 2005/06/06 01:51:48 wez Exp $ */ +/* $Id: zend_language_scanner.l,v 1.127 2005/06/07 18:11:56 dmitry Exp $ */ #define yyleng SCNG(yy_leng) #define yytext SCNG(yy_text) @@ -1485,6 +1485,7 @@ <ST_IN_SCRIPTING>"/**"{WHITESPACE} { CG(comment_start_line) = CG(zend_lineno); + RESET_DOC_COMMENT(); BEGIN(ST_DOC_COMMENT); yymore(); } @@ -1501,7 +1502,7 @@ } <ST_DOC_COMMENT>"*/" { - CG(doc_comment) = yytext; /* no copying - intentional */ + CG(doc_comment) = estrndup(yytext, yyleng); CG(doc_comment_len) = yyleng; HANDLE_NEWLINES(yytext, yyleng); BEGIN(ST_IN_SCRIPTING);

« previous php.zend-engine.cvs (#3752) next »