php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #54089
Patch tokenizer_patch_full.txt revision 2011-09-15 14:32 UTC by nikic@php.net
revision 2011-09-13 17:11 UTC by nikic@php.net
Patch tokenizer_patch.txt revision 2011-09-15 14:27 UTC by nikic@php.net
revision 2011-09-13 15:50 UTC by nikic@php.net
revision 2011-09-13 07:51 UTC by nicolas dot grekas+php at gmail dot com

Patch tokenizer_patch.txt for Unknown/Other Function Bug #54089

Patch version 2011-09-13 15:50 UTC

Return to Bug #54089 | Download this patch
This patch is obsolete

Obsoleted by patches:

This patch renders other patches obsolete

Obsolete patches:

Patch Revisions: 2011-09-15 14:27 UTC | 2011-09-13 15:50 UTC | 2011-09-13 07:51 UTC

Developer: nikic@php.net



  Index: ext/tokenizer/tests/bug54089.phpt
  ===================================================================
 --- ext/tokenizer/tests/bug54089.phpt	(revision 316815)
 --- ext/tokenizer/tests/bug54089.phpt	(revision 316568)
  +++ ext/tokenizer/tests/bug54089.phpt	(working copy)
  @@ -17,7 +17,7 @@
   var_dump($code);
   ?>


  -string(21) "<?php __halt_compiler"
  +string(24) "<?php __halt_compiler();"
  Index: ext/tokenizer/tests/token_get_all_variation16.phpt
  ===================================================================
 --- ext/tokenizer/tests/token_get_all_variation16.phpt	(revision 316815)
 --- ext/tokenizer/tests/token_get_all_variation16.phpt	(revision 316568)
  +++ ext/tokenizer/tests/token_get_all_variation16.phpt	(working copy)
  @@ -47,17 +47,17 @@
   
   list($value1,$value2) = $c;


   }
   Done
  Index: ext/tokenizer/tokenizer.c
  ===================================================================
 --- ext/tokenizer/tokenizer.c	(revision 316815)
 --- ext/tokenizer/tokenizer.c	(revision 316568)
  +++ ext/tokenizer/tokenizer.c	(working copy)
  @@ -106,6 +106,7 @@
   	int token_type;
   	zend_bool destroy;
Line 108 (now 108), was 20 lines, now 17 lines

  +	int need_tokens = -1; // for __halt_compiler lexing. -1 = disabled
   
   	array_init(return_value);
   
 @@ -152,8 +153,16 @@
 @@ -152,8 +153,13 @@
   
   		token_line = CG(zend_lineno);
   
  -		if (token_type == T_HALT_COMPILER) {
  -			break;
  +		// after T_HALT_COMPILER collect the next three non-dropped tokens
  +		if (need_tokens != -1) {
 +			if (token_type != T_WHITESPACE && token_type != T_OPEN_TAG
 +			    && token_type != T_COMMENT && token_type != T_DOC_COMMENT
 +			    && --need_tokens == 0
 +			) {
 +			if (destroy && --need_tokens == 0) {
  +				break;
  +			}
  +		} else if (token_type == T_HALT_COMPILER) {
  +			need_tokens = 3;
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 18:01:58 2014 UTC