Home Drupal Fatal error: Cannot use EllisLabExpressionEngineLibraryParserConditionalTokenBool as Bool because ‘Bool’ is a special...

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 🙂

NO COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Exit mobile version