View Issue Details

IDProjectCategoryView StatusLast Update
0007118OXID eShop (all versions)4.07. Source code, Testpublic2024-07-03 13:21
Reportermichael_keiluweit Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status confirmedResolutionopen 
Product Version6.2.0 
Summary0007118: ProjectYamlDao::saveProjectConfigFile does not check if file is writeable
DescriptionWhen a module is activated which has a service.yaml in its directory, the module activation services will register it by calling the method ProjectYamlDao::saveProjectConfigFile

\OxidEsales\EshopCommunity\Internal\Framework\Module\Setup\Service\ModuleActivationService::activate
[...]
\OxidEsales\EshopCommunity\Internal\Framework\DIContainer\Dao\ProjectYamlDao::saveProjectConfigFile

The content of the method:
    public function saveProjectConfigFile(DIConfigWrapper $config)
    {
        if (!$this->filesystem->exists($this->getGeneratedServicesFileDirectory())) {
            $this->filesystem->mkdir($this->getGeneratedServicesFileDirectory());
        }

        file_put_contents(
            $this->context->getGeneratedServicesFilePath(),
            Yaml::dump($config->getConfigAsArray(), 3, 2)
        );
    }


As you see the return value from file_put_contents isn't evaluated.
If the rights of the directory or the file itself of /var/www/shop/var/generated/generated_services.yaml are not sufficient enough, the file will not be modified, the service not registered and the administrator gets this error message in the backend:

OXID Logger.ERROR: You have requested a non-existent service "OxidEsales\GraphQL\Base\Framework\ModuleSetup". ["[object] (Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException(code: 0): You have requested a non-existent service \"OxidEsales\\GraphQL\\Base\\Framework\\ModuleSetup\". at /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php:1060)


Which would let you think that the module is broken. But truly the folder permissions are wrong, which should be checked and handled by the shop framework.
TagsDI, Exception, File Permissions, Module, Service
ThemeNot defined
BrowserNot defined
PHP VersionNot defined
Database VersionNot defined

Activities

florian.engelhardt

2020-04-15 10:41

reporter   ~0013185

Thanks for reporting this, as we already discussed I can confirm this behavior

QA

2020-04-15 13:38

administrator   ~0013186

-MK