WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#9441 closed enhancement (wontfix)

Code Quality: Use of a global Variable instead of a function with a static local variable

Reported by: hakre Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: needs-patch
Focuses: Cc:

Description

function force_ssl_admin (wp-includes/functions.php line ~2963ff) only exists to set a static variable inside that function.

instead a global variable can be used.

even the global variable might not be used, because since 2.6 a constant FORCE_SSL_ADMIN does exists.

I suggest to remove the function and replace the places where it is called with either setting a (global) variable or getting it.

Change History (6)

#1 @hakre
8 years ago

same for force_ssl_login(), even code duplication here!

#2 @ionfish
8 years ago

  • Type changed from defect (bug) to enhancement

#3 @hakre
8 years ago

  • Milestone changed from Unassigned to 2.9

#4 follow-up: @ryan
8 years ago

  • Milestone 2.9 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Those functions provide for overriding the FORCE_SSL constants. Removing them would cause back compat issues.

#5 in reply to: ↑ 4 @hakre
8 years ago

  • Keywords needs-patch added

Replying to ryan:

Those functions provide for overriding the FORCE_SSL constants. Removing them would cause back compat issues.

ryan, you didn't get my point. those functions are in there soley for the case to mimic the behaviour of a global variable. not that I very much global variables, but these functions can be called as "an implementation of a global variable".

#6 @hakre
8 years ago

thanks for core-dev feedback anyway.

Note: See TracTickets for help on using tickets.