php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78846 'T_BAD_CHARACTER' undeclared
Submitted: 2019-11-21 02:03 UTC Modified: 2019-12-24 08:52 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: twose at qq dot com Assigned:
Status: Closed Package: Compile Failure
PHP Version: master-Git-2019-11-21 (Git) OS: Ubuntu16
Private report: No CVE-ID: None
 [2019-11-21 02:03 UTC] twose at qq dot com
Description:
------------
/bin/bash /home/twosee/workspace/php/php-src/libtool --silent --preserve-dup-deps --mode=compile cc     -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -IZend/ -I/home/twosee/workspace/php/php-src/Zend/ -DPHP_ATOM_INC -I/home/twosee/workspace/php/php-src/include -I/home/twosee/workspace/php/php-src/main -I/home/twosee/workspace/php/php-src -I/usr/include/valgrind -I/home/twosee/workspace/php/php-src/ext/date/lib -I/usr/include/x86_64-linux-gnu -I/home/twosee/workspace/php/php-src/ext/mbstring/libmbfl -I/home/twosee/workspace/php/php-src/ext/mbstring/libmbfl/mbfl -I/home/twosee/workspace/php/php-src/TSRM -I/home/twosee/workspace/php/php-src/Zend    -I/usr/include -g -fvisibility=hidden -O0 -Wall -Wno-strict-aliasing -DZEND_SIGNALS   -c /home/twosee/workspace/php/php-src/Zend/zend_language_scanner.c -o Zend/zend_language_scanner.lo
Zend/zend_language_scanner.l: In function 'lex_scan':
Zend/zend_language_scanner.l:2865:15: error: 'T_BAD_CHARACTER' undeclared (first use in this function)
  RETURN_TOKEN(T_BAD_CHARACTER);
               ^
Zend/zend_language_scanner.l:1220:11: note: in definition of macro 'RETURN_TOKEN'
   goto emit_token; \
           ^~~~~~
Zend/zend_language_scanner.l:2865:15: note: each undeclared identifier is reported only once for each function it appears in
  RETURN_TOKEN(T_BAD_CHARACTER);
               ^
Zend/zend_language_scanner.l:1220:11: note: in definition of macro 'RETURN_TOKEN'
   goto emit_token; \
           ^~~~~~
Makefile:1357: recipe for target 'Zend/zend_language_scanner.lo' failed
make: *** [Zend/zend_language_scanner.lo] Error 1
make: *** Waiting for unfinished jobs....

===============

PHP master (f7c44ef2a0e1e1e5bed5527b8899c66b00416f43)

$ uname -a
Linux ubuntu 4.15.0-66-generic #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.4.0-1ubuntu1~18.04.1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)

$ bison -V
bison (GNU Bison) 3.0.4
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

====

$configure.sh

./configure \
  --disable-all \
  --with-config-file-path=${__DIR__}/etc \
  --with-config-file-scan-dir=${__DIR__}/conf \
  --enable-debug \
  --enable-cli \
  --enable-fpm \
  --enable-ctype \
  --enable-tokenizer (or disable) \
  --enable-opcache \
  --enable-filter \
  --enable-json \
  --enable-mbregex \
  --enable-mbstring=all \
  --with-mhash=/usr/local \
  --with-pcre-regex \
  --with-pcre-dir=/usr/local \
  --enable-posix \
  --enable-pcntl \
  --enable-sockets \
  --with-curl \
  --with-iconv \
  --with-openssl \
  --enable-mysqlnd \
  --enable-pdo \
  --with-pdo-mysql=mysqlnd \
  --with-mysqli=mysqlnd \
  --disable-opcache-jit


Expected result:
----------------
Compile successfully

Actual result:
--------------
'T_BAD_CHARACTER' undeclared


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-11-21 08:12 UTC] cmb@php.net
T_BAD_CHARACTER is supposed to be defined in
zend_language_parser.h, which is generated from
zend_language_parser.y.  Maybe the header has not been properly
generated, or a wrong header is included in
<https://github.com/php/php-src/blob/a3a9a1e0401d0cc00a5c6d44cad26c195a99ef92/Zend/zend_language_scanner.l#L38>.
 [2019-11-21 09:50 UTC] twose at qq dot com
/* A Bison parser, made by GNU Bison 3.0.4.  */

/* Bison interface for Yacc-like parsers in C

   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

/* As a special exception, you may create a larger work that contains
   part or all of the Bison parser skeleton and distribute that work
   under terms of your choice, so long as that work isn't itself a
   parser generator using the skeleton or a modified version thereof
   as a parser skeleton.  Alternatively, if you modify or redistribute
   the parser skeleton itself, you may (at your option) remove this
   special exception, which will cause the skeleton and the resulting
   Bison output files to be licensed under the GNU General Public
   License without this special exception.

   This special exception was added by the Free Software Foundation in
   version 2.2 of Bison.  */

#ifndef YY_ZEND_USERS_TWOSEE_TOAST_PROJECTS_PHP_SRC_ZEND_ZEND_LANGUAGE_PARSER_H_INCLUDED
# define YY_ZEND_USERS_TWOSEE_TOAST_PROJECTS_PHP_SRC_ZEND_ZEND_LANGUAGE_PARSER_H_INCLUDED
/* Debug traces.  */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int zenddebug;
#endif
/* "%code requires" blocks.  */
#line 48 "/Users/twosee/Toast/Projects/php-src/Zend/zend_language_parser.y" /* yacc.c:1915  */


#line 47 "/Users/twosee/Toast/Projects/php-src/Zend/zend_language_parser.h" /* yacc.c:1915  */

/* Token type.  */
#include "zend.h"
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
  enum yytokentype
  {
    END = 0,
    PREC_ARROW_FUNCTION = 258,
    T_INCLUDE = 259,
    T_INCLUDE_ONCE = 260,
    T_REQUIRE = 261,
    T_REQUIRE_ONCE = 262,
    T_LOGICAL_OR = 263,
    T_LOGICAL_XOR = 264,
    T_LOGICAL_AND = 265,
    T_PRINT = 266,
    T_YIELD = 267,
    T_DOUBLE_ARROW = 268,
    T_YIELD_FROM = 269,
    T_PLUS_EQUAL = 270,
    T_MINUS_EQUAL = 271,
    T_MUL_EQUAL = 272,
    T_DIV_EQUAL = 273,
    T_CONCAT_EQUAL = 274,
    T_MOD_EQUAL = 275,
    T_AND_EQUAL = 276,
    T_OR_EQUAL = 277,
    T_XOR_EQUAL = 278,
    T_SL_EQUAL = 279,
    T_SR_EQUAL = 280,
    T_POW_EQUAL = 281,
    T_COALESCE_EQUAL = 282,
    T_COALESCE = 283,
    T_BOOLEAN_OR = 284,
    T_BOOLEAN_AND = 285,
    T_IS_EQUAL = 286,
    T_IS_NOT_EQUAL = 287,
    T_IS_IDENTICAL = 288,
    T_IS_NOT_IDENTICAL = 289,
    T_SPACESHIP = 290,
    T_IS_SMALLER_OR_EQUAL = 291,
    T_IS_GREATER_OR_EQUAL = 292,
    T_SL = 293,
    T_SR = 294,
    T_INSTANCEOF = 295,
    T_INC = 296,
    T_DEC = 297,
    T_INT_CAST = 298,
    T_DOUBLE_CAST = 299,
    T_STRING_CAST = 300,
    T_ARRAY_CAST = 301,
    T_OBJECT_CAST = 302,
    T_BOOL_CAST = 303,
    T_UNSET_CAST = 304,
    T_POW = 305,
    T_NEW = 306,
    T_CLONE = 307,
    T_NOELSE = 308,
    T_ELSEIF = 309,
    T_ELSE = 310,
    T_LNUMBER = 311,
    T_DNUMBER = 312,
    T_STRING = 313,
    T_VARIABLE = 314,
    T_INLINE_HTML = 315,
    T_ENCAPSED_AND_WHITESPACE = 316,
    T_CONSTANT_ENCAPSED_STRING = 317,
    T_STRING_VARNAME = 318,
    T_NUM_STRING = 319,
    T_EVAL = 320,
    T_EXIT = 321,
    T_IF = 322,
    T_ENDIF = 323,
    T_ECHO = 324,
    T_DO = 325,
    T_WHILE = 326,
    T_ENDWHILE = 327,
    T_FOR = 328,
    T_ENDFOR = 329,
    T_FOREACH = 330,
    T_ENDFOREACH = 331,
    T_DECLARE = 332,
    T_ENDDECLARE = 333,
    T_AS = 334,
    T_SWITCH = 335,
    T_ENDSWITCH = 336,
    T_CASE = 337,
    T_DEFAULT = 338,
    T_BREAK = 339,
    T_CONTINUE = 340,
    T_GOTO = 341,
    T_FUNCTION = 342,
    T_FN = 343,
    T_CONST = 344,
    T_RETURN = 345,
    T_TRY = 346,
    T_CATCH = 347,
    T_FINALLY = 348,
    T_THROW = 349,
    T_USE = 350,
    T_INSTEADOF = 351,
    T_GLOBAL = 352,
    T_STATIC = 353,
    T_ABSTRACT = 354,
    T_FINAL = 355,
    T_PRIVATE = 356,
    T_PROTECTED = 357,
    T_PUBLIC = 358,
    T_VAR = 359,
    T_UNSET = 360,
    T_ISSET = 361,
    T_EMPTY = 362,
    T_HALT_COMPILER = 363,
    T_CLASS = 364,
    T_TRAIT = 365,
    T_INTERFACE = 366,
    T_EXTENDS = 367,
    T_IMPLEMENTS = 368,
    T_OBJECT_OPERATOR = 369,
    T_LIST = 370,
    T_ARRAY = 371,
    T_CALLABLE = 372,
    T_LINE = 373,
    T_FILE = 374,
    T_DIR = 375,
    T_CLASS_C = 376,
    T_TRAIT_C = 377,
    T_METHOD_C = 378,
    T_FUNC_C = 379,
    T_COMMENT = 380,
    T_DOC_COMMENT = 381,
    T_OPEN_TAG = 382,
    T_OPEN_TAG_WITH_ECHO = 383,
    T_CLOSE_TAG = 384,
    T_WHITESPACE = 385,
    T_START_HEREDOC = 386,
    T_END_HEREDOC = 387,
    T_DOLLAR_OPEN_CURLY_BRACES = 388,
    T_CURLY_OPEN = 389,
    T_PAAMAYIM_NEKUDOTAYIM = 390,
    T_NAMESPACE = 391,
    T_NS_C = 392,
    T_NS_SEPARATOR = 393,
    T_ELLIPSIS = 394,
    T_ERROR = 395
  };
#endif

/* Value type.  */



ZEND_API int zendparse (void);

#endif /* !YY_ZEND_USERS_TWOSEE_TOAST_PROJECTS_PHP_SRC_ZEND_ZEND_LANGUAGE_PARSER_H_INCLUDED  */
 [2019-11-21 10:57 UTC] twose at qq dot com
It works now after I remove all of the cache files

How can I clean up these cache files except `git clean -xfd`?
 [2019-11-26 10:25 UTC] cmb@php.net
Have you tried `make clean`?
 [2019-11-27 03:51 UTC] twose at qq dot com
I tried (As file changes are not recognized like CMake,I call make clean every time before compiling), but only `git clean -xfd` can make it work
I suspect that `make clean` does not clean all of the cache files completely
 [2019-12-24 08:47 UTC] laruence@php.net
-Status: Open +Status: Feedback
 [2019-12-24 08:47 UTC] laruence@php.net
please set YACC and RE2C in Makefile, then rm Zend/zend_language_parse.c (which is generated by zend_language_parse.y) , and redo make.
 [2019-12-24 08:52 UTC] twose at qq dot com
-Status: Feedback +Status: Closed
 [2019-12-24 08:52 UTC] twose at qq dot com
solved
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Sep 23 19:03:37 2021 UTC