Ticket #4702 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

Fatal error when making child category

Reported by: Viper007Bond Assigned to: ryan
Priority: highest omg bbq Milestone: 2.3
Component: Administration Version: 2.3
Severity: blocker Keywords: has-patch 2nd-opinion
Cc:

Description

Go to Manage -> Categories and try to make a new category that's the child of another category. Doing so will produce the following error:

Catchable fatal error: Object of class stdClass could not be converted to string in [...]\wp-includes\taxonomy.php on line 765

Editing a category and turning it into the child of another also causes this issue.

Props to Ryan Fitzer for finding the issue.

Attachments

4702.001.diff (0.7 kB) - added by markjaquith on 08/06/07 04:05:26.
Accept $parent as object or int

Change History

08/05/07 23:42:09 changed by Viper007Bond

PHP v5.2.1, MySQL v5.0.37

08/06/07 03:53:46 changed by markjaquith

I get:

Catchable fatal error: Object of class stdClass could not be converted to string in [...]/wp-includes/taxonomy.php on line 647

Both lines are $wpdb->query() calls.

08/06/07 04:05:26 changed by markjaquith

  • attachment 4702.001.diff added.

Accept $parent as object or int

08/06/07 04:08:00 changed by markjaquith

  • keywords set to has-patch 2nd-opinion.
  • owner changed from anonymous to ryan.

There's my swing at it... but I don't know if the error is that these functions don't accept term objects as well as ints or if the error is that these functions are being passed parent term objects. I opted for the more liberal case and accepted either. Would like to get Ryan's feedback on this one as this is his code.

08/14/07 03:56:10 changed by ryan

Let me look through the code, I don't remember intending it to take objects.

08/24/07 18:40:28 changed by ryan

The call to get_category in wp_insert_category take the category ID as a ref. It then assigns the retrieved object to it, thus changing the id to an object. That ref is pretty useless. Let's remove it. Also, category_exists would be a better way to check the cat.

08/24/07 18:41:01 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

(In [5938]) Don't pass cat as ref. Fix some term sanitization. fixes #4702