WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#4961 closed defect (bug) (wontfix)

multiple wp_dropdown_categories broken

Reported by: pixline Owned by: westi
Milestone: Priority: normal
Severity: normal Version: 2.2.3
Component: General Keywords: has-patch
Focuses: Cc:

Description

Writing a complex template management panel, I've found that is impossibile to use multiple wp_dropdown_categories because of a function called stamp_cat() , that is located inside &get_categories() and re-instanziated every dropdown request. This produce errors like:

Fatal error: Cannot redeclare stamp_cat() (previously declared in /Users/gomez/Sites/wpmu/wp-includes/category.php:99) in /Users/gomez/Sites/wpmu/wp-includes/category.php on line 99

I moved stamp_cat outside &get_categories, and it works for me. I've also made a patch for that, but I'm not sure if this can have some downside in other areas (maybe there's a reason for stamp_cat to be there, and I simply can't know it).

Bug first reported on <a href="http://trac.mu.wordpress.org/ticket/420">WPMU Trac</a>, and bounced back here because is a shared issue.

Attachments (2)

category.php-patch_wp (822 bytes) - added by pixline 9 years ago.
patch for category.php against WP 223
category.php-patch_wpmu (816 bytes) - added by pixline 9 years ago.
patch for WPMU against 1.2.5

Download all attachments as: .zip

Change History (8)

@pixline
9 years ago

patch for category.php against WP 223

@pixline
9 years ago

patch for WPMU against 1.2.5

#1 @westi
9 years ago

  • Milestone changed from 2.4 (next) to 2.3
  • Owner changed from anonymous to westi
  • Status changed from new to assigned
  • Version set to 2.2.3

Hmm.

-1 to globalising stamp_cat unless it is really needed elsewhere.

It looks like stamp_cat should be a lambda function really using create_function

#2 follow-up: @pixline
9 years ago

Can you explain me why? I can't understand it, and I just want to learn about it.

The patches I've submitted are just a shared working hack for my project, because I need to make it work *now*, but I can't understand what kind of issue may be caused by globalizing that function.

#3 in reply to: ↑ 2 @westi
9 years ago

  • Milestone changed from 2.3 to 2.2.3

Replying to pixline:

Can you explain me why? I can't understand it, and I just want to learn about it.

The patches I've submitted are just a shared working hack for my project, because I need to make it work *now*, but I can't understand what kind of issue may be caused by globalizing that function.

There is not a specific issue with globalising the function.

The reason for using create_function is the function has a very specific purpose - to be passed to array_map and so using create_function is cleaner IMHO.

Removing from the 2.3 milestone as this code no longer exists in 2.3

#4 @westi
9 years ago

Closing as WONTFIX as we are now working on 2.4 (and bug fixes for 2.3 (and security fixes for 2.0)) the above code doesn't appear in trunk, branches/2.3 or branches/2.0

#5 @westi
9 years ago

  • Resolution set to wontfix
  • Status changed from assigned to closed

#6 @foolswisdom
9 years ago

  • Milestone 2.2.3 deleted
Note: See TracTickets for help on using tickets.