Opened 6 years ago
Closed 6 years ago
#4702 closed defect (bug) (fixed)
Fatal error when making child category
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| 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 (1)
Change History (7)
comment:1
Viper007Bond — 6 years ago
comment:2
markjaquith — 6 years ago
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.
comment:3
markjaquith — 6 years ago
- Keywords has-patch 2nd-opinion added
- 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.
Let me look through the code, I don't remember intending it to take objects.
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.

PHP v5.2.1, MySQL v5.0.37