• The plugin has a hardcoded path which causes issues on WP installations that have a different file structure.

    The message is:
    Warning: fopen(/path/to/site/web/wp/wp-content/plugins/gravityforms/gravityforms.php): failed to open stream: No such file or directory

    This error is caused by:
    gf-form-multicolumn/includes/public/WH_GF_Multicolumn_Public_Form_Current.php
    in
    WH\GF\Multicolumn\Site\WH_GF_Multicolumn_Public_Form_Current::structure_form_elements at line 120.

    In plugin trunk: https://plugins.trac.www.ads-software.com/browser/gf-form-multicolumn/trunk/includes/public/WH_GF_Multicolumn_Public_Form_Current.php#L119

    The offending code is:

    
    		$gfInstallation      = get_plugin_data( ABSPATH .
    		                                        'wp-content/plugins/gravityforms/gravityforms.php' );
    

    The solution is:

    
    		$gfInstallation      = get_plugin_data( WP_CONTENT_DIR .
    		                                        'plugins/gravityforms/gravityforms.php' );
    

    tl;dr do not assume the path to the plugins directory as this can be different for some installations.

    • This topic was modified 3 years, 4 months ago by codepuncher.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author WebHolism

    (@webholism)

    Hi @krypsin,

    Thank you for this detailed description of the issue. This will be addressed and we will notify you soon as we have an update.

    Many thanks for taking the time to inform us of this issue.

    Kind regards.

    Thread Starter codepuncher

    (@krypsin)

    Thanks @webholism .

    Do you have an ETA on when a new release will be published?

    Plugin Author WebHolism

    (@webholism)

    Hi @krypsin,

    Thanks for the message.

    We plan on a release early next week. We hope that this is okay.

    Kind regards.

    Plugin Author WebHolism

    (@webholism)

    Hi @krypsin,

    Please can you check the v3.2.1 release to see if it resolves the issue, and advise if you experience any problems?

    Thank you for your patience.

    Kind regards.

    Thread Starter codepuncher

    (@krypsin)

    Hi @webholism,

    Yes, the latest version resolves this issue thanks.

    However, we are presented with 2 final issues to resolve:

    Issue 1:
    Notice: Trying to access array offset on value of type null in gf-form-multicolumn/includes/public/WH_GF_Multicolumn_Public_Form_Current.php on line 152

    Caused by:

    
    $divisor = ( $this->rowColumnArray[$this->rowCounter] > 0 ) ?
        $this->rowColumnArray[$this->rowCounter] : 1;
    

    Why:
    This assumes that $this->rowColumnArray is an array. However, it is defined without a value which results in it being null: private $rowColumnArray;

    The fix:
    Change private $rowColumnArray; to private $rowColumnArray = [];

    ==========

    Issue 2:
    After resolving the above, you will see a new issue.
    Notice: Undefined offset: 1 in gf-form-multicolumn/includes/public/WH_GF_Multicolumn_Public_Form_Current.php on line 152

    Caused by:

    
    $divisor = ( $this->rowColumnArray[$this->rowCounter] > 0 ) ?
        $this->rowColumnArray[$this->rowCounter] : 1;
    

    Why:
    This assumes that $this->rowColumnArray has an index of $this->rowCounter but since $this->rowColumnArray starts as an empty array, it will result in an undefined index.

    The fix:
    Change

    
    $divisor = ( $this->rowColumnArray[$this->rowCounter] > 0 ) ?
        $this->rowColumnArray[$this->rowCounter] : 1;
    

    To

    
    $divisor = ( ( $this->rowColumnArray[$this->rowCounter] ?? 0 ) > 0 ) ?
        $this->rowColumnArray[$this->rowCounter] : 1;
    

    If the index does not exist, the value will default to 0.

    All changes proposed are compatible with your plugins minimum PHP version, 7.0.

    Thanks

    • This reply was modified 3 years, 3 months ago by codepuncher.
    Plugin Author WebHolism

    (@webholism)

    Hi @krypsin,

    Many thanks for taking the time to provide so much in-depth information on the issue and the solutions.

    It would be ideal to be able to implement the changes in the next update, the only problem is that the notice messages that you are providing do not appear to be displaying in our WordPress installations. Would it be possible for you to state what approach you are using to display those PHP Notice messages that you have copied into this thread?

    Your time and expertise are greatly appreciated.

    Kind regards.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Bug + fix – Broken plugin path throwing errors’ is closed to new replies.