|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78750 configure assumes yacc and re2c work
Submitted: 2019-10-25 03:13 UTC Modified: 2020-06-07 19:56 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: php-bugs-2019 at ryandesign dot com Assigned:
Status: Closed Package: *Compile Issues
PHP Version: 7.4.0RC4 OS: macOS
Private report: No CVE-ID: None
 [2019-10-25 03:13 UTC] php-bugs-2019 at ryandesign dot com
The configure script was modified in PHP 7.4 to test for the bison and re2c version. But the code to do so assumes that the program that it found responds to the --version flag and outputs a version number. If the program is found (or if the user specifies which program to use with the YACC or RE2C environment variables) but the output from the program is empty or doesn't include the version number, then the configure script inadvertently outputs all of its variables and functions.

For years, with PHP 7.3.x and earlier, I've been configuring PHP with the environment variables LEX=true RE2C=true YACC=true. I did this to ensure that the build system did not regenerate the parsers, even if the right versions of lex, re2c or bison were installed; I could not find any other way to tell the build system not to do that. Now, with PHP 7.4, that doesn't work anymore, or maybe it does work, but it produces tons of undesired output in the process.

This is because the configure script runs `$YACC --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | tr -d a-z`, assigns that to the variable php_bison_version, saves IFS, sets IFS to ".", and runs `set $php_bison_version`. If $php_bison_version is not empty, this sets the positional parameters. But if $php_bison_version is empty, it outputs all variables and functions. And similarly with $RE2C.

> If no options or arguments are supplied, set displays the names and values of all
> shell variables and functions

Test script:
YACC=true ./configure

Expected result:

checking for bison... true
checking for bison version... unknown


Actual result:

checking for bison... true
checking for bison version... AWK=gawk
BASH_VERSINFO=([0]="3" [1]="2" [2]="57" [3]="1" [4]="release" [5]="x86_64-apple-darwin17")
CFLAGS='-g -O2'
CONFIGURE_COMMAND=' '\''./configure'\'' '


expr: not a decimal number: 'dummy'



bison-re2c-version.patch (last revision 2020-01-13 21:57 UTC by php-bugs-2019 at ryandesign dot com)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-31 10:40 UTC]
-Assigned To: +Assigned To: petk
 [2019-10-31 10:40 UTC]
@petk: Can you take a look at this?
 [2020-01-13 21:57 UTC] php-bugs-2019 at ryandesign dot com
The following patch has been added/updated:

Patch Name: bison-re2c-version.patch
Revision:   1578952651
 [2020-06-07 19:55 UTC]
The following pull request has been associated:

Patch Name: Fix #78750: configure assumes yacc and re2c work
On GitHub:
 [2020-06-07 19:56 UTC]
-Status: Assigned +Status: Open -Assigned To: petk +Assigned To:
 [2020-06-08 22:46 UTC]
Automatic comment on behalf of
Log: Fix #78750: configure assumes yacc and re2c work
 [2020-06-08 22:46 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Jul 15 03:01:24 2020 UTC