Support » Plugin: Send PDF for Contact Form 7 » Warnings appearing upon “save settings”

  • Resolved WPMonkeyATL

    (@wpmonkeyatl)


    On the latest version 0.6.1: I’m seeing the following warnings appear when I hit Save Settings:

    Warning: Illegal string offset ‘ID’ in …/wp-content/plugins/send-pdf-for-contact-form-7/mpdf/classes/cssmgr.php on line 1302

    Warning: Cannot assign an empty string to a string offset in …/wp-content/plugins/send-pdf-for-contact-form-7/mpdf/classes/cssmgr.php on line 1302

    Warning: Illegal string offset ‘LANG’ in …wp-content/plugins/send-pdf-for-contact-form-7/mpdf/classes/cssmgr.php on line 1307

    Warning: Cannot assign an empty string to a string offset in …wp-content/plugins/send-pdf-for-contact-form-7/mpdf/classes/cssmgr.php on line 1307

    Warning: Illegal string offset ‘ID’ in …wp-content/plugins/send-pdf-for-contact-form-7/mpdf/classes/cssmgr.php on line 1355

    Warning: Illegal string offset ‘LANG’ in …wp-content/plugins/send-pdf-for-contact-form-7/mpdf/classes/cssmgr.php on line 1355

Viewing 2 replies - 1 through 2 (of 2 total)
  • I investigated the issue further, and believe I have found the root problem as well as a possible solution (see code below).

    It seems the plugin may not be fully compatible with PHP 5.4 and higher, as PHP changed their warning message when functions are passed arrays vs. strings, as is discussed here:

    http://stackoverflow.com/questions/15361392/how-do-i-correct-this-illegal-string-offset

    Further, this same issue may be an underlying cause of the “arrow spins endlessly” issue reported previously, which I am also experiencing:

    https://wordpress.org/support/topic/email-sends-yet-the-arrow-spins-indefinitely/#post-9114560

    An approach that worked for me (which fixed both this “warnings upon save” issue as well as the “arrow spins indefinitely” issue was to make a few adjustments to explicitly check for array on lines 1302, 1306, 1308 and 1355 of the file /mpdf/classes/cssmgr.php as follows:

    Line 1302
    ------------------
    Original:
    if (!isset($attr['ID'])) {
    UPDATED:
    if (is_array($attr) && !isset($attr['ID'])) {
    
    
    Line 1306
    ------------------
    Original:
    if (!isset($attr['LANG'])) {
    UPDATED:
    if (is_array($attr) && !isset($attr['LANG'])) {
    
    
    Line 1308
    ------------------
    Original:
    } else {
    UPDATED:
    } else if (is_array($attr)) {
    
    
    Line 1355
    ------------------
    Original:
    $this->_mergeFullCSS($this->cascadeCSS, $this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'], $tag, $classes, $attr['ID'], $attr['LANG']);
    UPDATED:
    $this->_mergeFullCSS($this->cascadeCSS, $this->mpdf->blk[$this->mpdf->blklvl]['cascadeCSS'], $tag, $classes, (is_array($attr) && isset($attr['ID']))?$attr['ID']:'', (is_array($attr) && isset($attr['LANG']))?$attr['LANG']:'');
    
    

    I hope the plugin author is able to verify these issues and update the plugin with a permanent solution.

    Thank you in advance.

    Plugin Author Florent Maillefaud

    (@florent73)

    Hi!

    Thanks for your report. I fixed the notices errors.

    Just uninstall/install plugin or replace files by FTP.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Warnings appearing upon “save settings”’ is closed to new replies.