Breaking all images if WP_DEBUG = true (wpdb prepare errors. Fix inside)
-
Hello,
With the latest version of WordPress, and when activating
WP_DEBUG = true
your plugin break all images because it adds PHP error in image headers.The problem come from your wpdb::prepare calls in the file
/prevent-direct-access/inclues/repository.php
Line 48: $preparation = $this->wpdb->prepare( $queryString, $value, ARRAY_A );
Line 56: $preparation = $this->wpdb->prepare( $queryString, $post_id, ARRAY_A );
Line 72: $preparation = $this->wpdb->prepare( $queryString, $guid, ARRAY_A );
Line 80: $preparation = $this->wpdb->prepare( $queryString, $name, ARRAY_A );
Line 92: $advance_file = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM $this->table_name WHERE url LIKE %s", $url, ARRAY_A ) );
Line 102: $preparation = $this->wpdb->prepare( $queryString, $is_prevented, ARRAY_A );
On each one of those lines, remove the
, ARRAY_A
at the end inside the functions calls.wpdb->prepare
is expecting arguments, notARRAY_A
orOBJECT
. You should end up with:Line 48: $preparation = $this->wpdb->prepare( $queryString, $value );
Line 56: $preparation = $this->wpdb->prepare( $queryString, $post_id );
Line 72: $preparation = $this->wpdb->prepare( $queryString, $guid );
Line 80: $preparation = $this->wpdb->prepare( $queryString, $name );
Line 92: $advance_file = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM $this->table_name WHERE url LIKE %s", $url ) );
Line 102: $preparation = $this->wpdb->prepare( $queryString, $is_prevented );
Other than that, nice plugin ??
Regards.
- The topic ‘Breaking all images if WP_DEBUG = true (wpdb prepare errors. Fix inside)’ is closed to new replies.