Download & Extend

Rename drupal_set_header()

Project:Drupal core
Version:7.x-dev
Component:base system
Category:task
Priority:normal
Assigned:brianV
Status:closed (fixed)
Issue tags:API clean-up, Needs Documentation

Issue Summary

#372563: Rename drupal_set_html_head() renamed drupal_set_html_head() to drupal_add_html_head().

We still have drupal_set_header(), which is totally confusing now. One uses 'add', the other 'set'.

Let's rename drupal_set_header() equally to drupal_add_header().

Comments

#1

Status:active» needs review

This patch should do it.

AttachmentSizeStatusTest resultOperations
rename_drupal_set_header.patch15.41 KBIdleFailed: Failed to apply patch.View details

#2

Assigned to:Anonymous» brianV

#3

Priority:critical» normal

I'm not sure it is confusing. What is confusing is that you can't tell weather it is a HTTP header or a HTML head(er). Certainly not critical.

#4

@Dries,

'set' and 'add' both work equally well for this function. 'add' was suggested to match the other function.

Perhaps 'drupal_set_http_header()' or 'drupal_add_http_header()' would be more apt?

#5

drupal_add_http_header() works for me.

#6

ok - I will reroll a patch with drupal_add_http_header() in a bit.

#7

New patch

AttachmentSizeStatusTest resultOperations
rename_drupal_set_header-rev2.patch15.57 KBIdleFailed: Failed to apply patch.View details

#8

Note that drupal_set_header() not only adds new headers, but also allows replacing and unsetting headers previously set. drupal_add_http_header() might still be a better name, though.

#9

I'd like to get @sun's feedback on the proposed name change.

#10

Status:needs review» needs work

The last submitted patch failed testing.

#11

drupal_add_http_header() would work for me as well.

Though - one could also argue that we have

- drupal_chmod() as replacement for PHP's chmod()
- drupal_function_exists() as replacement for PHP's function_exists()
- drupal_mail() as replacement for mail()
- and many more...

So, a different alternative would be to just rename it to drupal_header() - as replacement for PHP's header().

Please also note that in case we rename to drupal_add_http_header(), we should probably also rename drupal_get_header() accordingly.

#12

Tagging for feature freeze.

#13

New patch rolled, renames the following functions:

  • drupal_set_header to drupal_add_http_header
  • drupal_get_header to drupal_get_http_header
AttachmentSizeStatusTest resultOperations
451604-rename-drupal-set-header-rev3.patch18.91 KBIdleFailed: 12924 passes, 10 fails, 0 exceptionsView details

#14

Status:needs work» needs review

#15

Status:needs review» needs work

The last submitted patch failed testing.

#16

Status:needs work» needs review

Re-rolled. Should come back green.

AttachmentSizeStatusTest resultOperations
drupal.rename-drupal-set-header.16.patch19.47 KBIdleFailed: Failed to apply patch.View details

#17

Status:needs review» reviewed & tested by the community

yay api cleanup!

#19

Status:reviewed & tested by the community» needs work

The last submitted patch failed testing.

#20

Status:needs work» needs review

/me stops counting how many RTBC patches he needs to re-roll...

AttachmentSizeStatusTest resultOperations
drupal.rename-drupal-set-header.20.patch19.73 KBIdlePassed: 13501 passes, 0 fails, 0 exceptionsView details

#21

I like the addition of "_http_" to the function name.

I'm not sure that I like the change from "_set_" to "_add_", though. drupal_add_html_head() simply adds the supplied string to an unstructured variable. The added values cannot be read or changed later on. The drupal_get_header()/drupal_set_header() pair, on the other hand, reads and writes named entries in an array. I think this behaviour is closer related to cache_get()/cache_set() than to drupal_add_html_head().

However, if we decide to stick with the proposed function names, the patch looks RTBC to me.

#22

Status:needs review» reviewed & tested by the community

FYI: #552478: Make self-closing optional in theme_html_tag() will turn drupal_add_html_head() into a structured array. :)

Reverting status.

#23

Status:reviewed & tested by the community» fixed

Committed to CVS HEAD. Thanks!

#24

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#25

Status:closed (fixed)» needs work
Issue tags:+Needs Documentation

This change should be mentioned on http://drupal.org/node/224333.

My permission to edit that page seems to have been revoked.

#26

Priority:normal» critical

Documentation is critical isn't it!?

#27

Priority:critical» normal

#653068: Update documentation is incomplete

#28

Documentation has been added to http://drupal.org/update/modules/6/7.

#29

Status:needs work» closed (fixed)
nobody click here