Receiving this warning many times in the logs when running PHP7.1 for watermarked image.

Warning: A non-numeric value encountered in imagecache_actions_calculate_offset() (line 376 of /home/mysite/public_html/sites/all/modules/imagecache_actions/utility.inc).

Image preset used:
* Autorotate image based on its EXIF data.
* Scale width 555 (upscaling allowed)
* Overlay (watermark) public://watermark/logo.png, x:right, y:top, alpha:50%, scale:-

Comments

jasonschweb created an issue. See original summary.

fietserwin’s picture

Title: PHP Warning on PHP7.1 » PHP 7.1 Warning "A non-numeric value encountered"
Version: 7.x-1.7 » 7.x-1.x-dev
Assigned: Unassigned » fietserwin

- This warning is new in 7.1: http://php.net/manual/en/migration71.other-changes.php#migration71.other-changes.apprise-on-arithmetic-with-invalid-strings.
- The line concerned: $value = $base + ($direction * $value); where it turns out that $value can e.g. be the empty string or a string like "10px".

With a long background in strongly typed languages, I never really liked those "silent conversions" but I am afraid that there are quite a lot in our code base and I have no idea how to find them all. I hope that by running our test set I can catch most of them, but I will have to install PHP 7.1 to start with. Those that remain will then have to be repaired 1 by 1 whenever they get reported.

I will start working on this issue and report back when I have replaced this one and others that I can find with our "test suite".

  • fietserwin committed 0aec9bc on 7.x-1.x
    [#2917097]: PHP 7.1 Warning "A non-numeric value encountered".
    
fietserwin’s picture

Status: Active » Fixed

I didn't find many problems. Fixed and committed those that I found. Thanks for reporting.

Status: Fixed » Closed (fixed)

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