WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 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)

comment:1 hakre5 years ago

same for force_ssl_login(), even code duplication here!

comment:2 ionfish5 years ago

  • Type changed from defect (bug) to enhancement

comment:3 hakre5 years ago

  • Milestone changed from Unassigned to 2.9

comment:4 follow-up: ryan5 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.

comment:5 in reply to: ↑ 4 hakre5 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".

comment:6 hakre5 years ago

thanks for core-dev feedback anyway.

Note: See TracTickets for help on using tickets.