Incorrect Pipe mode

Created on 24 January 2023, over 1 year ago
Updated 16 June 2024, 11 days ago

Problem/Motivation

While generating PDF document Drupal logs contain next notice:

Notice: stream_get_contents(): read of 8192 bytes failed with errno=9 Bad file descriptor in print_pdf_wkhtmltopdf_print_pdf_generate() (line 103 of /.../sites/all/modules/print/print_pdf/lib_handlers/print_pdf_wkhtmltopdf/print_pdf_wkhtmltopdf.pages.inc).

The notice appears while running the module with PHP 7.4.33. While investigating the issue it became known that proc_open() works with pipes in "r" or "w" mode. The module uses stderr pipe in "a" mode. Regarding PHP documentation in this case it's treated as "r", https://www.php.net/manual/en/function.proc-open.php:

An array describing the pipe to pass to the process. The first element is the descriptor type and the second element is an option for the given type. Valid types are pipe (the second element is either r to pass the read end of the pipe to the process, or w to pass the write end) and file (the second element is a filename). Note that anything else than w is treated like r.

Related task: https://www.drupal.org/project/print/issues/1645464 β†’ .

Proposed resolution

Use stderr pipe in "w" mode.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine aprogs

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024