php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74972 Undefined constant: Parser Tokens
Submitted: 2017-07-22 14:20 UTC Modified: 2017-07-24 08:01 UTC
From: php at amvc dot nl Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 7.1.7 OS: Alpine Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at amvc dot nl
New email:
PHP Version: OS:

 

 [2017-07-22 14:20 UTC] php at amvc dot nl
Description:
------------
(first of all sorry; I'm not sure if affected package is correct)

Usage of parser tokens results in a undefined constant notice since (at least) 7.1.5 on Alpine Linux.

alpine:3.5 is working fine, aline:3.6 and :edge are causing problems. 

---------

FROM alpine:edge

RUN apk add --no-cache php7

RUN php7 -v
RUN php7 -m
RUN php7 -r 'var_dump(T_ECHO);'
RUN php7 -r 'var_dump(T_PRINT);'

---------

Step 3/6 : RUN php7 -v
 ---> Running in 17cb9b5034d5
PHP 7.1.7 (cli) (built: Jul 19 2017 03:13:06) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
 ---> e0fb51b72d87
Removing intermediate container 17cb9b5034d5
Step 4/6 : RUN php7 -m
 ---> Running in 0865a247ab4d
[PHP Modules]
Core
date
filter
hash
libxml
pcre
readline
Reflection
SPL
standard

[Zend Modules]

 ---> 1d44b74e76e0
Removing intermediate container 0865a247ab4d
Step 5/6 : RUN php7 -r 'var_dump(T_ECHO);'
 ---> Running in b1a53a02f747
PHP Notice:  Use of undefined constant T_ECHO - assumed 'T_ECHO' in Command line code on line 1
string(6) "T_ECHO"
 ---> 0c783b3043b5
Removing intermediate container b1a53a02f747
Step 6/6 : RUN php7 -r 'var_dump(T_PRINT);'
 ---> Running in c3d7f000fdac
string(7) "T_PRINT"
PHP Notice:  Use of undefined constant T_PRINT - assumed 'T_PRINT' in Command line code on line 1


Test script:
---------------
var_dump(T_PRINT);

Expected result:
----------------
int(266)

Actual result:
--------------
string(7) "T_PRINT"
PHP Notice:  Use of undefined constant T_PRINT - assumed 'T_PRINT' in Command line code on line 1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-22 14:58 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2017-07-22 14:58 UTC] nikic@php.net
Parser tokens are definde by the tokenizer extension. You probably need to install and/or enable it in some way.
 [2017-07-24 08:01 UTC] php at amvc dot nl
Thank you nikic! I didn't realised that Tokenizer is a php extension. Adding php7-tokenizer solves the problem.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 09:01:33 2025 UTC