PHP7.4 upgrade has just killed our site!

Trying to access array offset on value of type null in /var/www/html/Neos/Packages/Libraries/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php line 1002

site stop working right after php7.4 update, any page from freont end or backend…

see also https://www.drupal.org/project/block_styles/issues/3168455

(ouch)

Neos\Flow\Error\ErrorHandler::handleError(8, "Trying to access array offset on value of type null", "/var/www/html/Neos/Packages/Libraries/doctrine/ann…ions/lib/Doctrine/Common/Annotations/DocParser.php", 1002, array|1|)
Packages/Libraries/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
01000:         $className = $this->lexer->token['value'];
01001: 
01002:         while ($this->lexer->lookahead['position'] === ($this->lexer->token['position'] + strlen($this->lexer->token['value']))
01003:                 && $this->lexer->isNextToken(DocLexer::T_NAMESPACE_SEPARATOR)) {
01004: 
Doctrine\Common\Annotations\DocParser::Identifier()
Packages/Libraries/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
00685: 
00686:         // check if we have an annotation
00687:         $name = $this->Identifier();
00688: 
00689:         if ($this->lexer->isNextToken(DocLexer::T_MINUS)
Doctrine\Common\Annotations\DocParser::Annotation()
Packages/Libraries/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
00661: 
00662:             $this->isNestedAnnotation = false;
00663:             if (false !== $annot = $this->Annotation()) {
00664:                 $annotations[] = $annot;
00665:             }
Doctrine\Common\Annotations\DocParser::Annotations()
Packages/Libraries/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
00352:         $this->lexer->moveNext();
00353: 
00354:         return $this->Annotations();
00355:     }
00356: 
Doctrine\Common\Annotations\DocParser::parse("/**⏎ * An HTTP based multi-action controller.⏎ *⏎ …mplate path mapping can be defined.⏎ *⏎ * @api⏎ */", "class Neos\Flow\Mvc\Controller\ActionController_Original")
Packages/Libraries/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php
00403:     {
00404:         $ignoredAnnotationNames = self::$globalIgnoredNames;
00405:         $annotations            = $this->preParser->parse($class->getDocComment(), 'class ' . $class->name);
00406: 
00407:         foreach ($annotations as $annotation) {
Doctrine\Common\Annotations\AnnotationReader::collectParsingMetadata(Neos\Flow\Reflection\ClassReflection)
Packages/Libraries/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php
00336:         }
00337: 
00338:         $this->collectParsingMetadata($class);
00339: 
00340:         return $this->imports[$name];
Doctrine\Common\Annotations\AnnotationReader::getClassImports(Neos\Flow\Reflection\ClassReflection)
Packages/Libraries/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php
00351:     {
00352:         $class = $method->getDeclaringClass();
00353:         $classImports = $this->getClassImports($class);
00354:         if (!method_exists($class, 'getTraits')) {
00355:             return $classImports;
Doctrine\Common\Annotations\AnnotationReader::getMethodImports(Neos\Flow\Reflection\MethodReflection)
Packages/Libraries/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php
00280: 
00281:         $this->parser->setTarget(Target::TARGET_METHOD);
00282:         $this->parser->setImports($this->getMethodImports($method));
00283:         $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class));
00284:         $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces);
Doctrine\Common\Annotations\AnnotationReader::getMethodAnnotations(Neos\Flow\Reflection\MethodReflection)
Packages/Framework/Neos.Flow/Classes/Reflection/ReflectionService.php
00797: 
00798:         $annotations = [];
00799:         $methodAnnotations = $this->annotationReader->getMethodAnnotations(new MethodReflection($className, $methodName));
00800:         if ($annotationClassName === null) {
00801:             return $methodAnnotations;
Neos\Flow\Reflection\ReflectionService::getMethodAnnotations("Neos\Neos\Controller\Backend\BackendController", "initializeAction", "Neos\Flow\Annotations\ValidationGroups")
Packages/Framework/Neos.Flow/Classes/Reflection/ReflectionService.php
00827:             $this->initialize();
00828:         }
00829:         $annotations = $this->getMethodAnnotations($className, $methodName, $annotationClassName);
00830: 
00831:         return $annotations === [] ? null : current($annotations);
Neos\Flow\Reflection\ReflectionService::getMethodAnnotation("Neos\Neos\Controller\Backend\BackendController", "initializeAction", "Neos\Flow\Annotations\ValidationGroups")
Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Neos_Flow_Mvc_Controller_ActionController.php
Original File: Packages/Framework/Neos.Flow/Classes/Mvc/Controller/ActionController.php
00387:         foreach ($methodNames as $methodName) {
00388:             if (strlen($methodName) > 6 && strpos($methodName, 'Action', strlen($methodName) - 6) !== false) {
00389:                 $validationGroupsAnnotation = $reflectionService->getMethodAnnotation($className, $methodName, Flow\ValidationGroups::class);
00390:                 if ($validationGroupsAnnotation !== null) {
00391:                     $result[$methodName] = $validationGroupsAnnotation->validationGroups;
Neos\Flow\Mvc\Controller\ActionController_Original::getActionValidationGroups(Neos\Flow\ObjectManagement\ObjectManager)
Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Neos_Flow_Mvc_Controller_ActionController.php
Original File: Packages/Framework/Neos.Flow/Classes/Mvc/Controller/ActionController.php
00308:     {
00309:         return [
00310:             static::getActionValidationGroups($this->objectManager),
00311:             static::getActionMethodParameters($this->objectManager),
00312:             static::getActionValidateAnnotationData($this->objectManager),
Neos\Flow\Mvc\Controller\ActionController_Original::getInformationNeededForInitializeActionMethodValidators()
Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Neos_Flow_Mvc_Controller_ActionController.php
Original File: Packages/Framework/Neos.Flow/Classes/Mvc/Controller/ActionController.php
00327:     protected function initializeActionMethodValidators()
00328:     {
00329:         list($validateGroupAnnotations, $actionMethodParameters, $actionValidateAnnotations, $actionIgnoredArguments) = $this->getInformationNeededForInitializeActionMethodValidators();
00330: 
00331:         if (isset($validateGroupAnnotations[$this->actionMethodName])) {
Neos\Flow\Mvc\Controller\ActionController_Original::initializeActionMethodValidators()
Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Neos_Flow_Mvc_Controller_ActionController.php
Original File: Packages/Framework/Neos.Flow/Classes/Mvc/Controller/ActionController.php
00194: 
00195:         $this->initializeActionMethodArguments();
00196:         $this->initializeActionMethodValidators();
00197: 
00198:         $this->initializeAction();
Neos\Flow\Mvc\Controller\ActionController_Original::processRequest(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Mvc\ActionResponse)
Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Neos_Flow_Mvc_Dispatcher.php
Original File: Packages/Framework/Neos.Flow/Classes/Mvc/Dispatcher.php
00145:             try {
00146:                 $this->emitBeforeControllerInvocation($request, $response, $controller);
00147:                 $controller->processRequest($request, $response);
00148:                 $this->emitAfterControllerInvocation($request, $response, $controller);
00149:             } catch (StopActionException $exception) {
Neos\Flow\Mvc\Dispatcher_Original::initiateDispatchLoop(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Mvc\ActionResponse)
Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Neos_Flow_Mvc_Dispatcher.php
Original File: Packages/Framework/Neos.Flow/Classes/Mvc/Dispatcher.php
00096:             /** @var ActionRequest $request */
00097:             $firewall->blockIllegalRequests($request);
00098:             $this->initiateDispatchLoop($request, $response);
00099:         } catch (AuthenticationRequiredException $exception) {
00100:             $entryPointFound = false;
Neos\Flow\Mvc\Dispatcher_Original::dispatch(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Mvc\ActionResponse)
Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Neos_Flow_Mvc_DispatchComponent.php
Original File: Packages/Framework/Neos.Flow/Classes/Mvc/DispatchComponent.php
00080:         $this->setDefaultControllerAndActionNameIfNoneSpecified($actionRequest);
00081:         $actionResponse = $this->prepareActionResponse($componentContext->getHttpResponse());
00082:         $this->dispatcher->dispatch($actionRequest, $actionResponse);
00083:         // TODO: This should change in next major when the action response is no longer a HTTP response for backward compatibility.
00084:         $componentContext->replaceHttpResponse($actionResponse);
Neos\Flow\Mvc\DispatchComponent_Original::handle(Neos\Flow\Http\Component\ComponentContext)
Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Neos_Flow_Http_Component_ComponentChain.php
Original File: Packages/Framework/Neos.Flow/Classes/Http/Component/ComponentChain.php
00059:                 continue;
00060:             }
00061:             $component->handle($componentContext);
00062:             $this->response = $componentContext->getHttpResponse();
00063:             if ($componentContext->getParameter(ComponentChain::class, 'cancel') === true) {
Neos\Flow\Http\Component\ComponentChain_Original::handle(Neos\Flow\Http\Component\ComponentContext)
Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Neos_Flow_Http_Component_ComponentChain.php
Original File: Packages/Framework/Neos.Flow/Classes/Http/Component/ComponentChain.php
00059:                 continue;
00060:             }
00061:             $component->handle($componentContext);
00062:             $this->response = $componentContext->getHttpResponse();
00063:             if ($componentContext->getParameter(ComponentChain::class, 'cancel') === true) {
Neos\Flow\Http\Component\ComponentChain_Original::handle(Neos\Flow\Http\Component\ComponentContext)
Packages/Framework/Neos.Flow/Classes/Http/RequestHandler.php
00107:         }
00108: 
00109:         $this->baseComponentChain->handle($this->componentContext);
00110:         $response = $this->baseComponentChain->getResponse();
00111: 
Neos\Flow\Http\RequestHandler::handleRequest()
Packages/Framework/Neos.Flow/Classes/Core/Bootstrap.php
00109: 
00110:         $this->activeRequestHandler = $this->resolveRequestHandler();
00111:         $this->activeRequestHandler->handleRequest();
00112:     }
00113: 
Neos\Flow\Core\Bootstrap::run()
Web/index.php
00025: $context = \Neos\Flow\Core\Bootstrap::getEnvironmentConfigurationSetting('FLOW_CONTEXT') ?: 'Development';
00026: $bootstrap = new \Neos\Flow\Core\Bootstrap($context, $composerAutoloader);
00027: $bootstrap->run();

Instance root	/var/www/html/Neos/
Application Context	Development
Request Handler	Neos\Flow\Http\RequestHandler

What PHP version did you come from? And did you upgrade your packages as well?

It was running PHP 7.3 previously… and yes all packages were upgraded. I’m trying to figure out how to get this fixed ASAP - we have a ton of content… :slightly_frowning_face:

and… hmm
for reasons unknown, I had to reinstall composer. that went fine…

then I ran

[user5@xm www]# cd /var/www/html/Neos
[user5@xm Neos]# composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)

[Composer\DependencyResolver\SolverProblemsException]
Problem 1
- The requested package neos/setup could not be found in any version, t
here may be a typo in the package name.
Problem 2
- Installation request for neos/neos ~4.3.0 -> satisfiable by neos/neos
[4.3.17].
- neos/neos 4.3.17 requires neos/setup * -> no matching package found.
Problem 3
- neos/neos 4.3.17 requires neos/setup * -> no matching package found.
- neos/redirecthandler-neosadapter 3.1.0 requires neos/neos >=3.0 <5.0
|| dev-master -> satisfiable by neos/neos[4.3.17].
- Installation request for neos/redirecthandler-neosadapter ~3.0 -> sat
isfiable by neos/redirecthandler-neosadapter[3.1.0].
Potential causes:

update [–prefer-source] [–prefer-dist] [–dry-run] [–dev] [–no-dev] [–lock] [–no-custom-installers] [–no-autoloader] [–no-scripts] [–no-progress] [–no-suggest] [–with-dependencies] [–with-all-dependencies] [-v|vv|vvv|–verbose] [-o|–optimize-autoloader] [-a|–classmap-authoritative] [–apcu-autoloader] [–ignore-platform-reqs] [–prefer-stable] [–prefer-lowest] [-i|–interactive] [–root-reqs] [–] []…

Any hints?? (TIA)

Hey @aaarggghhhhhhhhhhhhh,

the installed Neos 4.3 is not compatible with PHP 7.4, see https://docs.neos.io/cms/installation-development-setup/system-requirements.

I would not recommend running composer on the server directly. I would first downgrade PHP to 7.3 again and then do a proper update to Neos 5.3.

1 Like

4.3 runs fine with 7.4 in its latest versions.

The composer output shows an issue with finding neos/setup, which is rather strange.

@aaarggghhhhhhhhhhhhh try to create an installable set with packages in your dev environment and deploy it again. You can also set the php platform version in your composer.json to make sure all packages are compatible when running composer update and later install on production.

1 Like

Here is my composer.json - I do not see a line for php platform version…

"name": "neos/neos-base-distribution",
"description": "Neos Base Distribution",
"license": "GPL-3.0+",
"support": {
    "email": "hello@neos.io",
    "slack": "http://slack.neos.io/",
    "forum": "https://discuss.neos.io/",
    "wiki": "https://discuss.neos.io/c/the-neos-project/project-documentation",
    "issues": "https://github.com/neos/neos-development-collection/issues",
    "docs": "http://neos.readthedocs.org/",
    "source": "https://github.com/neos/neos-base-distribution"
},
"config": {
    "vendor-dir": "Packages/Libraries",
    "bin-dir": "bin"
},
"require": {
    "neos/neos": "~4.3.0",
    "neos/nodetypes": "~4.3.0",
    "neos/site-kickstarter": "~4.3.0",

    "neos/demo": "~5.0.1",
    "neos/neos-ui": "~3.3",
    "neos/seo": "~3.0",
    "neos/fusion-afx": "~1.2",
    "neos/redirecthandler-neosadapter": "~3.0",
    "neos/redirecthandler-databasestorage": "~3.0",
    
    "neos/setup": "@dev"
},
"require-dev": {
    "neos/buildessentials": "@dev",
    "mikey179/vfsstream": "^1.6",
    "phpunit/phpunit": "^7.0",
    "symfony/css-selector": "~2.0",
    "neos/behat": "@dev"
},
"repositories": {
    "distributionPackages": {
        "type": "path",
        "url": "./DistributionPackages/*"
    }
},
"replace": {
    "neos/neos-base-distribution": "4.3.3"
},
"suggest": {
    "ext-pdo_sqlite": "For running functional tests out-of-the-box this is required"
},
"scripts": {
    "post-update-cmd": "Neos\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall",
    "post-install-cmd": "Neos\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall",
    "post-package-update": "Neos\\Flow\\Composer\\InstallerScripts::postPackageUpdateAndInstall",
    "post-package-install": "Neos\\Flow\\Composer\\InstallerScripts::postPackageUpdateAndInstall"
}

}

You should remove the line for “neos/setup” as it references a development branch. And in general removing everything in there that’s not relevant for your project (e.g. the neos/demo probably).
And the “replace” and “suggest” parts.
Also “require-dev” if you don’t run tests.

And in the composer docs you can find the platform setting: https://getcomposer.org/doc/06-config.md#platform

Please provide all information you can when opening issues in the future.
That saves a lot of time for the people who want to help you.

1 Like

PS: it’s not practical to downgrade to php7.3 now, it will break my mail server, among other things. Currently running 7.4.15 whihc is working splendidly for everything else.
is there a way to workaround this ’ array offset on value of type null’ ??
I rather desperately need to recover the site - the content creator spent about 200 hours on it…

I don’t mind hacking some files, if anyone can advise what I should be looking for! DocParser.php line 1002 does not have any obvious place I can insert a null check ( i.e. Add isset() checks around the null variables…)

@sebobo Sir: you are a gentleman and a scholar!! Applyig your changes allowed me to update composer AND THE SITE LIVES!!!

All this stuff is way above my pay grade, I am only a rudimentary php hacker :slight_smile:

THANK YOU VERY VERY MUCH for your assistance. I’m going to go back and read the docs, and look into setting up a DEV server to test an upgrade to latest Neos.

for the benefit of anyone who might have the same issue, this is the pared-down composer.json that allowed me to update composer:

{
    "name": "neos/neos-base-distribution",
    "description": "Neos Base Distribution",
    "license": "GPL-3.0+",
    "support": {
        "email": "hello@neos.io",
        "slack": "http://slack.neos.io/",
        "forum": "https://discuss.neos.io/",
        "wiki": "https://discuss.neos.io/c/the-neos-project/project-documentation",
        "issues": "https://github.com/neos/neos-development-collection/issues",
        "docs": "http://neos.readthedocs.org/",
        "source": "https://github.com/neos/neos-base-distribution"
    },
    "config": {
        "vendor-dir": "Packages/Libraries",
        "bin-dir": "bin"
    },
    "require": {
        "neos/neos": "~4.3.0",
        "neos/nodetypes": "~4.3.0",
        "neos/site-kickstarter": "~4.3.0",
        "neos/demo": "~5.0.1",
        "neos/neos-ui": "~3.3",
        "neos/seo": "~3.0",
        "neos/fusion-afx": "~1.2",
        "neos/redirecthandler-neosadapter": "~3.0",
        "neos/redirecthandler-databasestorage": "~3.0"

    },
    "repositories": {
        "distributionPackages": {
            "type": "path",
            "url": "./DistributionPackages/*"
        }
    },
    "scripts": {
        "post-update-cmd": "Neos\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall",
        "post-install-cmd": "Neos\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall",
        "post-package-update": "Neos\\Flow\\Composer\\InstallerScripts::postPackageUpdateAndInstall",
        "post-package-install": "Neos\\Flow\\Composer\\InstallerScripts::postPackageUpdateAndInstall"
    }
}
3 Likes