Opened 7 years ago
Closed 7 years ago
#35597 closed defect (bug) (wontfix)
Redefining already defined constructor for class WP_User_Search
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.6 |
Component: | Users | Keywords: | |
Focuses: | administration | Cc: |
Description
PHP [E_STRICT] 2048 : Redefining already defined constructor for class WP_User_Search in D:\webserver\Documents\wordpress\wp-admin\includes\deprecated.php at line 505
Change History (4)
#3
@
7 years ago
Hi @dd32
PHP : 5.2.5
my own plugins are using the __construct()
function
WP_User_Search is using both __construct()
line 482 AND WP_User_Search()
line 505
for information class wpdb is just using the __construct()
function
Hope this helps
#4
@
7 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
Yes, using both is not an issue, and is required for backwards compatibility with others who extend the classes, for example:
class DD32_WP_User_Search extends WP_User_Search { function __construct() { WP_User_Search::WP_User_Search(); // call parent constructor $this->customize_the_class(); } }
It was removed from some older classes such as wpdb
but we won't be removing it from classes in the future.
Update to a more modern PHP version and you'll no longer see that message (alternatively, tweak the error reporting not to show E_STRICT
's).
Hi @arena,
What version of PHP are you using?
I expect the answer will be PHP 5.3/5.4?
Unfortunately this isn't something we can change, for backwards compatibility with WordPress plugins, and also forwards compatibility with PHP 7.
Removing the extra PHP4-style constructor breaks compatibility with older WordPress plugins, Moving it before the new-style constructor silences the PHP 5.4 strict standard warning, but then emits a PHP7 warning.
IIRC PHP 5.5 dropped that Strict standard rule since it wasn't viable moving forward (I believe).