php drupal-check.phar modules/contrib/file_replace/
 4/4 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ---------------------------------------------------- 
  Line   src/Form/FileReplaceForm.php                        
 ------ ---------------------------------------------------- 
  81     Call to deprecated function file_unmanaged_copy().  
 ------ ---------------------------------------------------- 

                                                                                                                        
 [ERROR] Found 1 error

Comments

Sergiu Stici created an issue. See original summary.

sergiu stici’s picture

Status: Active » Needs review
StatusFileSize
new1.57 KB

Here is the patch, please review.

fjgarlin’s picture

Status: Needs review » Needs work

I checked this code and got the following error when visiting a replace page for a file:

TypeError: Argument 1 passed to Drupal\file_replace\Form\FileReplaceForm::__construct() must implement interface Drupal\Core\File\FileSystemInterface, instance of Drupal\Core\Entity\EntityRepository given, called in /var/www/drupal/public_html/web/core/lib/Drupal/Core/Entity/ContentEntityForm.php on line 73 in Drupal\file_replace\Form\FileReplaceForm->__construct() (line 25 of modules/contrib/file_replace/src/Form/FileReplaceForm.php).
Drupal\file_replace\Form\FileReplaceForm->__construct(Object, Object, Object) (Line: 73)
Drupal\Core\Entity\ContentEntityForm::create(Object) (Line: 33)
Drupal\file_replace\Form\FileReplaceForm::create(Object) (Line: 28)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition('Drupal\file_replace\Form\FileReplaceForm') (Line: 226)
Drupal\Core\Entity\EntityTypeManager->getFormObject('file', 'replace') (Line: 82)
Drupal\Core\Entity\HtmlEntityFormController->getFormObject(Object, 'file.replace.default') (Line: 78)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
The website encountered an unexpected error. Please try again later.

Without the patch I get to see the page without errors.

daniel korte’s picture

The error in #3 is because the dependency injection is not handled properly in the patch from #2, but I don't think dependency injection is really necessary here. Also, adding the core_version_requirement key to the info file.

daniel korte’s picture

Status: Needs work » Needs review
dydave’s picture

Title: Deprecated Code Report » D9 compatibility: Deprecated Code Report
dydave’s picture

dydave’s picture

Hi Everyone!

Thanks for contributing this patch.

I have tested the changes #4, overall they seem to work fine and fix the issue.
Just one thing: core: 8.x can to be removed from the info.yml file, when adding core_version_requirement, see for example: pathauto.info.yml.

Please find attached a re-roll from from patch in #4, which removes the line core: 8.x:
3084129-d9-compatibility-deprecated-code-reportd-8.patch.

Any suggestions, feedback, comments, reporting and testing, would be greatly appreciated.
Thanks in advance!

bryandenijs’s picture

Status: Needs review » Reviewed & tested by the community

Latest patch looks good! Tested it and it works.
Thanks for the patch!

  • casey committed d940f18 on 8.x-1.x authored by DYdave
    Issue #3084129 by Daniel Korte, Sergiu Stici, DYdave: D9 compatibility:...
casey’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks!

dydave’s picture

Thanks Casey for your help getting this in.
Cheers!

Status: Fixed » Closed (fixed)

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