# 404-solution/4.1.19/includes/php/wordpress/WPDBExtension.php

404 Solution, version 4.1.19. 46 lines.

- Page: https://pluginprobe.com/plugins/404-solution/4.1.19/code/includes/php/wordpress/WPDBExtension.php
- Raw: https://pluginprobe.com/plugins/404-solution/4.1.19/raw/includes/php/wordpress/WPDBExtension.php
- Modified: 2026-03-14T21:52:50+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/404-solution/4.1.19/code/includes/php/wordpress/WPDBExtension.php#L10-L20`.

```php
<?php


if (!defined('ABSPATH')) {
    exit;
}

if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
    class ABJ_404_Solution_WPDBExtension_PHP7 extends wpdb {
        /**
         * @param string $query
         * @return string|null
         */
        public function public_strip_invalid_text_from_query(string $query) {
            try {
                $result = $this->strip_invalid_text_from_query($query);
                return is_string($result) ? $result : null;
            } catch (Exception $e) {
                return null;
            } catch (Error $e) {
                return null;
            }
        }
    }
} else {
    class ABJ_404_Solution_WPDBExtension_PHP5 extends wpdb {
        /**
         * @param string $query
         * @return string|null
         */
        public function public_strip_invalid_text_from_query(string $query) {
            try {
                $result = $this->strip_invalid_text_from_query($query);
                /** @var mixed $resultMixed */
                $resultMixed = $result;
                if (is_object($resultMixed) && method_exists($resultMixed, 'get_error_message')) {
                    return 'WP_Error: ' . $resultMixed->get_error_message();
                }
                return is_string($result) ? $result : null;
            } catch (Exception $e) {
                return null;
            }
        }
    }
}

```
