Viewing 5 replies - 1 through 5 (of 5 total)
  • we also experienced the same issue

    Who is @daigo75 and why are they linking patched files from a dropbox site? That seems really sketchy?

    Thread Starter kjy112

    (@kjy112)

    @daigo75 is this new Yotpo update in conflict with Aelia Foundation plugin? Please be specific.

    @razorfrog I’m the author of many plugins for WordPress, including one that has been available on the WordPress repository for a decade. The Dropbox link was just a quick way to make a patched YOTPO plugin available with a Github repository included. I did that as a courtesy, but if that is seen as “sketchy” I would rather take it down.

    @kjy112 one of our users (@amistry) reported that the latest version of the YOTPO plugin introduces a non-namespaced function, called get_arr_value(), that is also declared in one of our plugins, namely the Aelia Foundation Classes. While the AFC performs a check to avoid declaring the same function twice, the YOTPO plugin does not. Due to that, if the AFC runs first, the YOTPO plugin tries to re-declare the same function and triggers the fatal error described by @amistry. This is something I already explained in my original reply.

    A simple workaround is to perform an if_exists() check before declaring the function. The two functions are equivalent, therefore YOTPO can use the one loaded by the AFC, at least until we’re done removing it. The patched version I linked does just that.

    The intention was to provide a quick fix, which would allow YOTPO to work normally, while the developers work to properly namespace the conflicting function.

    • This reply was modified 9 months, 3 weeks ago by Diego. Reason: Formatting

    If anyone wants to patch the YOTPO plugin themselves, and avoid the “sketchy” patched version, the change is simple. It’s a matter of finding the declaration of function get_arr_value() in the YOTPO plugin and wrapping it in a condition, as follows:

    if(!function_exists('get_arr_value')) {
    	function get_arr_value(array $object, string $key, $default = '') {
    		return isset($object[$key]) ? $object[$key] : $default;
    	}
    }
    

    That would be all. This will prevent the function from being declared twice, which is what causes the fatal error reported by @amistry.

    • This reply was modified 9 months, 3 weeks ago by Diego. Reason: Updated code snippet to illustrate the whole fix
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Update to Ver 1.7.4 Crashes Site’ is closed to new replies.