Generating QR Code without logo creates error

Created on 31 January 2024, 11 months ago

Problem/Motivation

$logo is not initialized in Drupal\endroid_qr_code\Response\QRImageResponse so if $this->file is not set, this error is generated in the log:

Warning: Undefined variable $logo in Drupal\endroid_qr_code\Response\QRImageResponse->generateQrCode() (line 143)

Line 143:
$result = $this->writer->write($qrCode, $logo, $label);

The PNGWriter will accept a null $logo.

Proposed resolution

Set $logo = null; before the $this->file check on line 131.

πŸ› Bug report
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States derekw

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

Merge Requests

Comments & Activities

  • Issue created by @derekw
  • Merge request !104.0.x β†’ (Open) created by derekw
  • Hello, I'm uploading a patch for this issue for version "drupal/endroid_qr_code": "4.0.x-dev@dev", where the problem is still there.

    I'm using the DEV version, because the latest 4.0 version is throwing the following error: ValueError: Path cannot be empty in file_get_contents() (Line 24 in /var/www/html/project/vendor/endroid/qr-code/src/ImageData/LogoImageData.php).

  • Status changed to RTBC 12 days ago
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    The changes in the MR fix the issue for me.

Production build 0.71.5 2024