Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 298406

PoStreamReader::readLine() throws an error on module install

$
0
0

Problem/Motivation

I've downaloaded a new module and want to enable it, but get fatal error. I've tried to enable several different modules and every time get this error:

$ drush en honeypot 
>  [notice] Checked fr translation for honeypot.
>  [notice] Checked nl translation for honeypot.
>  [error]  The specified file 'temporary://fileie34b1' could not be copied because the destination directory 'translations://' is not properly configured. This may be caused by a problem with file or directory permissions. 
>  [error]  Unable to download translation file https://ftp.drupal.org/files/translations/all/honeypot/honeypot-2.1.1.fr.po. 
>  [warning] fopen(translations://honeypot-2.1.1.fr.po): Failed to open stream: "Drupal\locale\StreamWrapper\TranslationsStream::stream_open" call failed PoStreamReader.php:154
>  [error]  TypeError: fgets(): Argument #1 ($stream) must be of type resource, bool given in fgets() (line 248 of /app/docroot/core/lib/Drupal/Component/Gettext/PoStreamReader.php) #0 /app/docroot/core/lib/Drupal/Component/Gettext/PoStreamReader.php(248): fgets(false)
> #1 /app/docroot/core/lib/Drupal/Component/Gettext/PoStreamReader.php(186): Drupal\Component\Gettext\PoStreamReader->readLine()
> #2 /app/docroot/core/lib/Drupal/Component/Gettext/PoStreamReader.php(217): Drupal\Component\Gettext\PoStreamReader->readItem()
> #3 /app/docroot/core/lib/Drupal/Component/Gettext/PoStreamReader.php(155): Drupal\Component\Gettext\PoStreamReader->readHeader()
> #4 /app/docroot/core/modules/locale/src/Gettext.php(56): Drupal\Component\Gettext\PoStreamReader->open()
> #5 /app/docroot/core/modules/locale/locale.bulk.inc(213): Drupal\locale\Gettext::fileToDatabase(Object(stdClass), Array)
> #6 /app/docroot/core/modules/locale/locale.batch.inc(191): locale_translate_batch_import(Object(stdClass), Array, Object(DrushBatchContext))
> #7 /app/vendor/drush/drush/includes/batch.inc(261): locale_translation_batch_fetch_import('honeypot', 'fr', Array, Object(DrushBatchContext))
> #8 /app/vendor/drush/drush/includes/batch.inc(206): _drush_batch_worker()
> #9 /app/vendor/drush/drush/includes/batch.inc(100): _drush_batch_command('414')
> #10 /app/vendor/drush/drush/src/Drupal/Commands/core/BatchCommands.php(22): drush_batch_command('414')
> #11 [internal function]: Drush\Drupal\Commands\core\BatchCommands->process('414', Array)
> #12 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
> #13 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #14 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #15 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(350): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #16 /app/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #17 /app/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #18 /app/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #19 /app/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #20 /app/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #21 /app/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
> #22 /app/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
> #23 /app/vendor/drush/drush/drush(4): require('/app/vendor/dru...')
> #24 /app/vendor/bin/drush(120): include('/app/vendor/dru...')
> #25 {main}. 

Steps to reproduce

  1. You should have a multilingual site.
  2. Add a new module, e.g: composer install drupal/honeypot.
  3. Enable it: drush en honeypot.

Expected result: module is successfully enabled, no errors.

Actual result: module is enabled, but there was a php error on translations import during module install.

Proposed resolution

After some investigation it turned out that we can modify just 1 line in PoStreamReader::readLine() to fix the issue, see a patch below.


Viewing all articles
Browse latest Browse all 298406

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>