Ticket #2888 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

New function to reset vars

Reported by: Sewar Assigned to: Sewar
Priority: normal Milestone: 2.1
Component: Optimization Version: 2.1
Severity: normal Keywords: bg|has-patch bg|needs-testing
Cc:

Description

Most files in wordpress/wp-admin/*.php start with 15-lines-code to reset vars in an array. So, just move this code to new function and put it in admin-functions.php. This is better than write same code in +10 files.

In the patch i used $_REQUEST because it contain both of $_POST and $_GET, this will offer some lines. Also, the var unseted according to #2595.

Also, isn't "foreach" better than "for"? or at least more cleaner?

Attachments

wp_reset_vars.diff (15.2 kB) - added by Sewar on 07/01/06 04:01:53.
comment.php.diff (0.8 kB) - added by Sewar on 07/04/06 12:24:37.
Patch for comment.php file

Change History

07/01/06 04:01:53 changed by Sewar

  • attachment wp_reset_vars.diff added.

07/01/06 04:21:04 changed by Sewar

  • keywords set to bg|has-patch bg|needs-testing.
  • owner changed from anonymous to Sewar.

07/01/06 04:54:10 changed by robmiller

Ha! I was just planning on doing this today. Nice work :)

07/03/06 19:03:42 changed by ryan

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

(In [3946]) wp_reset_vars() from Sewar. fixes #2888

07/03/06 19:06:54 changed by ryan

I've been wanting to do this for some time but never got around to it. Committed, thanks. A nice followup patch would be to audit the vars and remove those that are no longer relevant.

07/04/06 12:24:37 changed by Sewar

  • attachment comment.php.diff added.

Patch for comment.php file

07/04/06 12:25:05 changed by Sewar

  • status changed from closed to reopened.
  • resolution deleted.

The new patch is for comment.php file, i forget to merge it in the first patch. i just seen that it wasn't merged after updating SVN. Sorry for this.

07/04/06 19:31:29 changed by ryan

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

(In [3956]) wp_reset_vars(). Props Sewar. fixes #2888

07/05/06 03:59:41 changed by ryan

(In [3969]) Use POST and GET instead of REQUEST since they are sanitized. fixes #2888