Undefined constant %s::%s
Description
The requested class constant could not be found.
The error message is distinct for the global constants, although there is no mention of class in this one.
Example
<?php
class X {
const Z = 1;
private A = 2;
}
echo X::Y;
?>
Literal Examples
- Undefined constant X::CONSTANT
Alternatives
- Find the actual name of the requested class constant.
- Find the actual class of the requested class constant.
- Check the namespace, or its import.
- Check the visibility of the class constant: it may be private, or protected.
- Check the autoload system, to make sure the definition could be found.
- Define the class constant in the class, or its traits, interfaces or parents.
Related error messages
In previous PHP versions, this error message used to be :ref:undefined-class-constant-'%s::%s'.