Weird PHP error: "Undefined variable: value"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
php7.2 (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Bionic |
Triaged
|
Medium
|
Unassigned | ||
php7.3 (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Bionic |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
I observed a strange error when running PHPUnit tests with PHP 7.2 in Ubuntu 18.04.1 LTS.
In various files, there is the error "Undefined variable: value", although the variable is actually defined.
Very weird: It is actually the variable name "$value" that PHP does not like.
When changing the variable name from "$value" e.g. to "$valueFoo", the error disappears in that file, but will appear again in another file where there is also a variable called "$value".
I tried both with the latest PHPUnit version 7.5.2, and with Ubuntu's own package PHPUnit 6.5.5.
Using the latest PHP 7.2 from ppa:ondrej/php does not show this problem.
Is it possible that an outdated, buggy version of PHP 7.2 is used?
The build date is Sep 13 2018.
PHP 7.2.10-
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.10-
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
Thanks for your help!
Martin
-------
These are some example errors that I get:
1) DH\CoreBundle\
Undefined variable: value
.../1_source/
.../1_source/
.../1_source/
.../1_source/
.../1_source/
-------
There was 1 error:
1) DH\CoreBundle\
DH\CoreBundle\
.../1_source/
.../1_source/
Caused by
PHPUnit\
.../1_source/
.../1_source/
.../1_source/
-------
There were 7 errors:
1) DH\DataBundle\
Undefined variable: value
.../1_source/
.../1_source/
.../1_source/
.../1_source/
.../1_source/
.../1_source/
-------
$ lsb_release -rd
Description: Ubuntu 18.04.1 LTS
Release: 18.04
$ sudo apt-cache policy pkgname php7.2
[sudo] password for faro:
php7.2:
Installed: 7.2.10-
Candidate: 7.2.10-
Version table:
*** 7.2.10-
500 http://
500 http://
100 /var/lib/
7.2.3-1ubuntu1 500
500 http://
N: Unable to locate package pkgname
ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: php7.2 7.2.10-
ProcVersionSign
Uname: Linux 4.15.0-45-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.5
Architecture: amd64
CurrentDesktop: XFCE
Date: Mon Feb 4 08:35:12 2019
PackageArchitec
SourcePackage: php7.2
UpgradeStatus: No upgrade log present (probably fresh install)
Additional hint: The same code lines don't trigger any errors when running in Apache - only from CLI.