Problem/Motivation

After updating to PHP 7.4 I get this message:

Notice: Trying to access array offset on value of type bool en webform2pdf_enabled_pdf_access() (line 18 on /[...]/sites/all/modules/webform2pdf/webform2pdf.module).

Steps to reproduce

The only change was updating to PHP 7.4 version.

It shows the error when "Generate PDF Document" is disabled in the webform

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Sistemas SUMADOS created an issue. See original summary.

sis-sumados’s picture

Title: Notice: Trying to access array offset on value of type bool on php 7.4 » Notice: Trying to access array offset on value of type bool with PHP 7.4
sis-sumados’s picture

Issue summary: View changes

stedmanj made their first commit to this issue’s fork.

percoction’s picture

Here is a patch with a quick fix. It may not be the correct approach, but we are returning FALSE here in the access function if the DB query fetchAssoc() also returns FALSE

ponies’s picture

Would $row !== false be safer?

ponies’s picture

This feels pedantic but I added more checks.

sis-sumados’s picture

Thanks a lot :-)
It works for me

  • mr.york committed 195cc07 on 7.x-4.x authored by ponies
    Issue #3214591 by ponies, stedmanj, percoction: Notice: Trying to access...
mr.york’s picture

Status: Active » Fixed

Thank you!

Status: Fixed » Closed (fixed)

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

axle_foley00’s picture

This works for me as well. Will an official release for this fix be made? Maybe 7.x-4.2 release?

rmcom’s picture

Thank you for this great module. It would be great if this patch could be published in a new release.