Skip to main contentSkip to footer

Fatal error: Cannot use EllisLab\ExpressionEngine\Library\Parser\Conditional\Token\Bool as Bool because 'Bool' is a special class

Rupak Nepali
Share:
Fatal error: Cannot use EllisLab\ExpressionEngine\Library\Parser\Conditional\Token\Bool as Bool because 'Bool' is a special class

Fatal error: Cannot use EllisLab\ExpressionEngine\Library\Parser\Conditional\Token\Bool as Bool because ‘Bool’ is a special class

When you update your PHP version and you can see the above issue while working in the Expression Engine. I just commented out the following at core\EllisLab\ExpressionEngine\Library\Parser\Conditional\Lexer.php the boolean and string annotations:

use EllisLab\ExpressionEngine\Library\Parser\Conditional\Token\Token;
//use EllisLab\ExpressionEngine\Library\Parser\Conditional\Token\Bool;
use EllisLab\ExpressionEngine\Library\Parser\Conditional\Token\Comment;
use EllisLab\ExpressionEngine\Library\Parser\Conditional\Token\Number;
use EllisLab\ExpressionEngine\Library\Parser\Conditional\Token\Operator;
use EllisLab\ExpressionEngine\Library\Parser\Conditional\Token\Other;
//use EllisLab\ExpressionEngine\Library\Parser\Conditional\Token\String;
use EllisLab\ExpressionEngine\Library\Parser\Conditional\Token\Tag;
use EllisLab\ExpressionEngine\Library\Parser\Conditional\Token\Variable;

and following on the same file the bool part and the string part

switch ($type)
{
    //case 'BOOL':	 $obj = new Bool($lexeme);
    //	break;
    case 'COMMENT':	 $obj = new Comment($lexeme);
        break;
    case 'NUMBER':	 $obj = new Number($lexeme);
        break;
    case 'OPERATOR': $obj = new Operator($lexeme);
        break;
    case 'OTHER':	 $obj = new Other($lexeme);
        break;
    //case 'STRING':	 $obj = new String($lexeme);
    //	break;
    case 'TAG':		 $obj = new Tag($lexeme);
        break;
    case 'VARIABLE': $obj = new Variable($lexeme);
        break;
    default:
        $obj = new Token($type, $lexeme);
}

I disable the string part also because I get the following issues as well:
Fatal error: Cannot use EllisLab\ExpressionEngine\Library\Parser\Conditional\Token\String as String because ‘String’ is a special class name

Then I commented out following \core\EllisLab\ExpressionEngine\Library\Parser\Conditional\Parser.php

//use EllisLab\ExpressionEngine\Library\Parser\Conditional\Token\Bool;

With these two file changes above error is removed but I have not gone too deep issues inside it, make changes in your own risk 🙂

Comments

Join the conversation and share your thoughts

Leave a Comment

Your comment will be reviewed before publishing.

Be the first to comment on this post!

Innovation

Let's Make Something Amazing Together

We always provide our best creative ideas at the highest level. Tell us about your project and we will make it work.

InnovateBringing innovative solutions to complex problems
AutomateStreamlining processes through automation
DominateLeading the market with exceptional results
Build Smarter and Launch FasterEfficient development for rapid deployment