• Resolved EastDevonAlliance

    (@eastdevonalliance)


    Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in /wp-content/plugins/wp-mailing-group/mailing-group-module.php:246
    Stack trace:
    #0 /wp-includes/plugin.php(524): wpmg_add_mailing_group_plugin(”)
    #1 /wp-admin/plugins.php(166): do_action(‘activate_wp-mai…’)
    #2 {main} thrown in /wp-content/plugins/wp-mailing-group/mailing-group-module.php on line 246

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter EastDevonAlliance

    (@eastdevonalliance)

    Using PHP 7.

    Host is 1and1.co.uk

    Thread Starter EastDevonAlliance

    (@eastdevonalliance)

    Hmm … it looks like this plugin is not PHP7 compliant and this is why I am receiving this error. According to http://php.net/manual/en/function.mysql-real-escape-string.php:

    Warning
    mysql_real_escape_string was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:
    mysqli_real_escape_string()
    PDO::quote()

    I will try changing this call from mysql_ to mysqli_ and see if it works and post the results back here.

    Thread Starter EastDevonAlliance

    (@eastdevonalliance)

    There were 10 instances of mysql_real_escape_string in x and I replaced them with mysqli_real_escape_string and the plugin activated. So providing that the plugin works now that it is activated, this looks like an easy fix.

    I will now try to configure it and see if it works.

    Plugin Author Yamna Khawaja

    (@marcusbs)

    Thanks, in next release the plugin will be PHP 7 compliant.

    Plugin Author Yamna Khawaja

    (@marcusbs)

    A better choice would have been using esc_sql() which is a native wordpress function. https://codex.ww.wp.xz.cn/Function_Reference/esc_sql
    Thats untested for now. Will test soon.

    Thread Starter EastDevonAlliance

    (@eastdevonalliance)

    I was just looking for a quick and dirty fix to get it going.

    Having got it to activate I have been trying to make it work today – eventually I switched back to a configuration I had previously used but didn’t work, and hey presto it suddenly started working.

    But in this process I took a look at the code and also made a list of several minor issues. I am happy to provide you feedback via Skype if you are interested.

    But my biggest suggestion is that you should consider open sourcing the free version on GitHub to allow the community to help you improve the plugin more rapidly. You would need to retrofit these changes to the paid version which would remain proprietary code.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Cannot activate’ is closed to new replies.