Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#29139 closed defect (bug) (duplicate)

is_a() deprecation/un-deprecation

Reported by: areaareasasit's profile area@… Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9
Component: General Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

#23406

..as a developer, I configure local *AMP to show each message related to my project, so to avoid any problem when publishing it at production site.

Starting to work with WP I received many warnings (60) related to is_a() deprecation. I may solv it placing the statement "error_reporting( 0 );" in index.php at root folder but, if I do like that I also blind my visibility to other errors.

Due to this back and forth deprecation of is_a() it may be more convenient to definitely solve it with its "instanceof" declaration. Is there any good reason to leave code with warnings instead of "perfect" other than the priority to more complex issues? Security, of course, has to be the first but, if you need more resources at this stage I may do the change the 60 occurrences of is_a(), check it and send it to you.

Best wishes,

Carmine Iaciofano
Area

Change History (7)

#1 @SergeyBiryukov
10 years ago

  • Description modified (diff)

Related: #10264, #14131, #19381, #23406, #25672.

#2 @markoheijnen
10 years ago

I think this is a duplicate of #25672 which has a patch that should solve all the errors.

#3 @area@…
10 years ago

..this is the full list of occurrence of is_a(). It seems not to be a duplicated of the ticket you indicate:

/wp-admin/includes/class-wp-users-list-table.php:342: 		if ( !( is_object( $user_object ) && is_a( $user_object, 'WP_User' ) ) )
/wp-admin/includes/screen.php:378: 		if ( is_a( $hook_name, 'WP_Screen' ) )
/wp-admin/includes/template.php:163: 	if ( empty($walker) || !is_a($walker, 'Walker') )
/wp-admin/includes/theme.php:135: 	if ( ! is_a( $theme, 'WP_Theme' ) )
/wp-includes/capabilities.php:498: 		if ( is_a( $id, 'WP_User' ) ) {
/wp-includes/category-template.php:853: 	if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
/wp-includes/category-template.php:871: 	if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
/wp-includes/class-feed.php:40: 		if ( is_a($data, 'SimplePie') )
/wp-includes/class-IXR.php:85:         if (is_object($this->data) && is_a($this->data, 'IXR_Date')) {
/wp-includes/class-IXR.php:88:         if (is_object($this->data) && is_a($this->data, 'IXR_Base64')) {
/wp-includes/class-IXR.php:420:         if (is_a($result, 'IXR_Error')) {
/wp-includes/class-IXR.php:567:             if (is_a($result, 'IXR_Error')) {
/wp-includes/class-IXR.php:1009:                     if (!is_a($arg, 'IXR_Date')) {
/wp-includes/class-wp-customize-manager.php:618: 		if ( is_a( $id, 'WP_Customize_Setting' ) )
/wp-includes/class-wp-customize-manager.php:659: 		if ( is_a( $id, 'WP_Customize_Section' ) )
/wp-includes/class-wp-customize-manager.php:701: 		if ( is_a( $id, 'WP_Customize_Control' ) )
/wp-includes/class-wp-error.php:205: 	if ( is_object($thing) && is_a($thing, 'WP_Error') )
/wp-includes/class-wp-theme.php:276: 			if ( is_a( $_child, 'WP_Theme' ) && $_child->template == $this->stylesheet ) {
/wp-includes/compat.php:68: 		if ( !is_a($wp_json, 'Services_JSON') ) {
/wp-includes/compat.php:81: 		if ( !is_a($wp_json, 'Services_JSON') ) {
/wp-includes/deprecated.php:2673: 		if ( !is_a( $user, 'WP_User' ) ) {
/wp-includes/functions.wp-scripts.php:38: 	if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
/wp-includes/functions.wp-scripts.php:75: 	if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
/wp-includes/functions.wp-scripts.php:115: 	if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
/wp-includes/functions.wp-scripts.php:141: 	if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
/wp-includes/functions.wp-scripts.php:197: 	if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
/wp-includes/functions.wp-scripts.php:225: 	if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
/wp-includes/functions.wp-scripts.php:250: 	if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
/wp-includes/functions.wp-styles.php:37: 	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
/wp-includes/functions.wp-styles.php:70: 	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
/wp-includes/functions.wp-styles.php:105: 	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
/wp-includes/functions.wp-styles.php:127: 	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
/wp-includes/functions.wp-styles.php:160: 	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
/wp-includes/functions.wp-styles.php:186: 	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
/wp-includes/functions.wp-styles.php:210: 	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
/wp-includes/general-template.php:2666: 	if ( !is_a($wp_styles, 'WP_Styles') )
/wp-includes/ms-functions.php:2039:     if ( ! is_a( $user, 'WP_User' ) ) {
/wp-includes/pluggable.php:244: 	if ( !is_object( $phpmailer ) || !is_a( $phpmailer, 'PHPMailer' ) ) {
/wp-includes/post.php:418: 	if ( is_a( $post, 'WP_Post' ) ) {
/wp-includes/script-loader.php:775: 	if ( !is_a($wp_scripts, 'WP_Scripts') )
/wp-includes/script-loader.php:805: 	if ( !is_a($wp_scripts, 'WP_Scripts') )
/wp-includes/script-loader.php:874: 	if ( !is_a($wp_scripts, 'WP_Scripts') )
/wp-includes/script-loader.php:929: 	if ( !is_a($wp_styles, 'WP_Styles') )
/wp-includes/script-loader.php:963: 	if ( !is_a($wp_styles, 'WP_Styles') )
/wp-includes/template.php:138: 	if ( is_a( $author, 'WP_User' ) ) {
/wp-includes/Text/Diff/Renderer.php:86:             if (is_a($edit, 'Text_Diff_Op_copy')) {
/wp-includes/Text/Diff.php:77:             if (is_a($edit, 'Text_Diff_Op_add') ||
/wp-includes/Text/Diff.php:78:                 is_a($edit, 'Text_Diff_Op_change')) {
/wp-includes/Text/Diff.php:96:             if (is_a($edit, 'Text_Diff_Op_delete') ||
/wp-includes/Text/Diff.php:97:                 is_a($edit, 'Text_Diff_Op_change')) {
/wp-includes/Text/Diff.php:140:             if (!is_a($edit, 'Text_Diff_Op_copy')) {
/wp-includes/Text/Diff.php:158:             if (is_a($edit, 'Text_Diff_Op_copy')) {
/wp-includes/user.php:115: 	if ( is_a( $user, 'WP_User' ) ) {
/wp-includes/user.php:170: 	if ( is_a( $user, 'WP_User' ) ) {
/wp-includes/user.php:205: 	if ( $user && is_a( $user, 'WP_User' ) && is_multisite() ) {
/wp-includes/user.php:1534: 	if ( is_a( $userdata, 'stdClass' ) )
/wp-includes/user.php:1536: 	elseif ( is_a( $userdata, 'WP_User' ) )
/wp-includes/user.php:1782: 	if ( is_a( $userdata, 'stdClass' ) )
/wp-includes/user.php:1784: 	elseif ( is_a( $userdata, 'WP_User' ) )
/wp-includes/widgets.php:1358: 	if ( !is_a($widget_obj, 'WP_Widget') )

Let me know if I may be useful in any way to solve it.

Best wishes,

Carmine Iaciofano
Area

Last edited 10 years ago by area@… (previous) (diff)

#4 @SergeyBiryukov
10 years ago

The patch on #25672 appears to address all these instances.

#5 @area@…
10 years ago

  • Version changed from 3.9.1 to trunk

Dear Sergey,

you are right about the diff indication. I am more than happy that I was right about the issue as well as I am sorry I did not find it by myself, but I do not see it in WP 3.9.2 and it is not clear to me if it will be managed either only at level of patch to inject in case of needs or if it will become standard distribution (and when, in case).

Thanks for your patience,

Carmine Iaciofano
Area

Last edited 10 years ago by area@… (previous) (diff)

#6 @helen
10 years ago

  • Version changed from trunk to 3.9

#7 @markoheijnen
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #25672.

Marking as duplicated after checking the list. Thank you for generating that one since I had everything patched except /wp-includes/template.php. I included that one now too.

About next steps we can discuss it there and maybe it get addressed in 4.1

Note: See TracTickets for help on using tickets.