Problem/Motivation

I get an error in the backend on the update page /admin/reports/updates/update:
Your site cannot be automatically updated until further action is performed.
PhpTuf\ComposerStager\Internal\Path\Factory\PathFactory::create(): Argument #1 ($path) must be of type string, bool given, called in /srv/www/virtual2/sitename/htdocs/web/modules/contrib/automatic_updates/package_manager/src/Event/CollectPathsToExcludeEvent.php on line 96

Steps to reproduce

Drupal core 10.2.3, Automatic updates 3.0.0 installed.

CommentFileSizeAuthor
#3 automatic_updates-3424290.patch813 bytesabhishek_gupta1
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rehm created an issue. See original summary.

abhishek_gupta1’s picture

Assigned: Unassigned » abhishek_gupta1
abhishek_gupta1’s picture

Assigned: abhishek_gupta1 » Unassigned
Status: Active » Needs review
StatusFileSize
new813 bytes

@rehm, fixed the issue created Patch . please review it.

tedbow’s picture

@rehm did you install the module via Composer? Can provide your composer lock file? I wondering if there is some problem with your version of php-tuf/composer-stager for some reason.

@abhishek_gupta1 thanks for the patch but first we need to figure why there is boolean instead of string provide instead of just throwing an exception.

tedbow’s picture

Status: Needs review » Needs work

I wondering if the problem comes from \Drupal\package_manager\PathExcluder\SiteFilesExcluder::excludeSiteFiles

 if ($this->fileSystem->isAbsolutePath($path)) {
          $event->addPathsRelativeToProjectRoot([realpath($path)]);
        }

realpath() could return a false

tedbow’s picture

Issue tags: +Needs tests

@rehm this could be caused by your private or public file settings point to path that does not exist. These are usually set in setting.php . $settings['file_public_path'] or $settings['file_private_path'] you can check the current values at admin/config/media/file-system

I set

$settings['file_private_path'] = '/not/here';

and it caused the same error you experienced.

@rehm can you check these paths and see if they point to real paths?

tedbow’s picture

Issue tags: -Needs tests
tedbow’s picture

Status: Needs work » Needs review

tedbow’s picture

Assigned: Unassigned » phenaproxima
phenaproxima’s picture

Assigned: phenaproxima » tedbow
Status: Needs review » Needs work

One request (we should use the file_system service's realpath() function), otherwise RTBC from me. We might want to also add an @see to the test, or maybe a more expansive comment, to explain what's going on.

tedbow’s picture

Assigned: tedbow » phenaproxima
Status: Needs work » Needs review

@phenaproxima back to you

phenaproxima’s picture

Title: Error in CollectPathsToExcludeEvent.php -> must be string, boll given » Error in CollectPathsToExcludeEvent.php -> must be string, bool given
phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Looks pretty good to me!

  • tedbow committed 10c0945e on 3.0.x
    Issue #3424290 by abhishek_gupta1: Error in CollectPathsToExcludeEvent....
tedbow’s picture

Status: Reviewed & tested by the community » Fixed

🎉

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.