PHP 5.5 and msql extension warning
-
PHP Deprecated: mysql_real_escape_string(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead
Well, this plugin continues to work great even on WordPress 4; but from php 5.5 on, the mysql extension is officially deprecated and this plugin makes use of
mysq_real_escape
(that needs an active mysql connection) to escape posted parametersmaxwidth
andmaxheight
on its option page.The fix is really simple: use the WP escape function for sql query
esc_sql
! Just substitute the 2 occurences ofmysq_real_escape
withesc_sql
:
FROM:$maxwidth = trim(mysql_real_escape_string($_POST['maxwidth'])); $maxheight = trim(mysql_real_escape_string($_POST['maxheight']));
TO:
$maxwidth = trim( esc_sql($_POST['maxwidth']) ); $maxheight = trim( esc_sql($_POST['maxheight']));
Don’t know if the author is still interested in update this little usefull plugin, but I’ve posted this just in case someone else is looking for a solution to the problem.
- The topic ‘PHP 5.5 and msql extension warning’ is closed to new replies.