Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.4] Fix CLI core update crash when open_basedir includes JPATH_ROOT (#39285) #39286

Open
wants to merge 3 commits into
base: 4.4-dev
Choose a base branch
from

Conversation

Ars92
Copy link

@Ars92 Ars92 commented Nov 23, 2022

Pull Request for Issue #39285 .

Summary of Changes

\Joomla\CMS\Filesystem\Folder::create Was checking if the folder you want to create already exists after checking if its parents exist.
I don't see any reason to not check if the folder we want to create already exists before checking for its parents: these changes are for that.

Testing Instructions

  • Install a new site that can be updated to a new Joomla core version.
  • Set PHP open_basedir to include JPATH_ROOT.
  • Apply the patch.
  • Execute the CLI to update Joomla core: php cli/joomla.php core:update

Actual result BEFORE applying this Pull Request

The command crashes:

 6/8 -- Extracting update package ...
Warning: is_dir(): open_basedir restriction in effect. File(/var/www) is not within the allowed path(s): (/var/www/html:/tmp) in /var/www/html/libraries/src/Filesystem/Folder.php on line 484

Warning: is_dir(): open_basedir restriction in effect. File(/var) is not within the allowed path(s): (/var/www/html:/tmp) in /var/www/html/libraries/src/Filesystem/Folder.php on line 484

Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/html:/tmp) in /var/www/html/libraries/src/Filesystem/Folder.php on line 484

Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/html:/tmp) in /var/www/html/libraries/src/Filesystem/Folder.php on line 484

In Folder.php line 69:
                                    
  [RuntimeException (-1)]           
  Cannot create destination folder  
                                    

Exception trace:
  at /var/www/html/libraries/src/Filesystem/Folder.php:69
 Joomla\CMS\Filesystem\Folder::copy() at /var/www/html/libraries/src/Console/UpdateCoreCommand.php:385
 Joomla\CMS\Console\UpdateCoreCommand->copyFileTo() at /var/www/html/libraries/src/Console/UpdateCoreCommand.php:331
 Joomla\CMS\Console\UpdateCoreCommand->processUpdatePackage() at /var/www/html/libraries/src/Console/UpdateCoreCommand.php:216
 Joomla\CMS\Console\UpdateCoreCommand->updateJoomlaCore() at /var/www/html/libraries/src/Console/UpdateCoreCommand.php:168
 Joomla\CMS\Console\UpdateCoreCommand->doExecute() at /var/www/html/libraries/vendor/joomla/console/src/Command/AbstractCommand.php:235
 Joomla\Console\Command\AbstractCommand->execute() at /var/www/html/libraries/vendor/joomla/console/src/Application.php:1181
 Joomla\Console\Application->runCommand() at /var/www/html/libraries/vendor/joomla/console/src/Application.php:403
 Joomla\Console\Application->doExecute() at /var/www/html/libraries/src/Application/ConsoleApplication.php:191
 Joomla\CMS\Application\ConsoleApplication->doExecute() at /var/www/html/libraries/vendor/joomla/console/src/Application.php:448
 Joomla\Console\Application->execute() at /var/www/html/libraries/src/Application/ConsoleApplication.php:234
 Joomla\CMS\Application\ConsoleApplication->execute() at /var/www/html/cli/joomla.php:78

Expected result AFTER applying this Pull Request

Joomla core should update successfully.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@laoneo laoneo added the Maintainers Checked Used if the PR is conceptional useful label Nov 25, 2022
@Hackwar Hackwar added the Small A PR which only has a small change label Feb 26, 2023
@Hackwar Hackwar added the bug label Apr 7, 2023
@HLeithner HLeithner changed the base branch from 4.2-dev to 4.3-dev May 2, 2023 16:29
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 4.3-dev.

@laoneo laoneo removed the PR-4.2-dev label May 12, 2023
@HLeithner HLeithner changed the base branch from 4.3-dev to 4.4-dev September 30, 2023 22:44
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 4.4-dev.

@HLeithner HLeithner changed the title Fix CLI core update crash when open_basedir includes JPATH_ROOT (#39285) [4.4] Fix CLI core update crash when open_basedir includes JPATH_ROOT (#39285) Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Maintainers Checked Used if the PR is conceptional useful PR-4.4-dev Small A PR which only has a small change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants