The following functions are simple wrappers around their replacements. These should be marked @deprecated, will be removed before Drupal 8.0, and their replacements documented in change notices.
bootstrap.inc
t()
(or will we make an exception here?)
Removed (possibly accidentally) in #2219009: Improve DX of Settings classsettings()
(or will we make an exception here?)
format_string()
drupal_validate_utf8()
Marked deprecated in #2552579: Remove SafeMarkup::placeholder(), deprecate drupal_placeholder() and stop drupal_placeholder() from marking safe.drupal_placeholder()
_current_path()
(private anyway, but we might as well to avoid confusion)
common.inc
check_url()
by #2089433: Remove uses of deprecated XSS filter functionsfilter_xss_admin()
by #2089433: Remove uses of deprecated XSS filter functionsfilter_xss()
by #2089433: Remove uses of deprecated XSS filter functionsfilter_xss_bad_protocol()
format_date()
by #2221695: Remove uses of deprecated URL functionsurl_is_external()
Being handled by #2339219: [meta] Finalize URL generation API (naming, docs, deprecation)url()
Should not be deprecated, see #2113015: Add drupal_merge_attached() function, to merge #attached assets.drupal_merge_js_settings()
Should not be deprecated, see #2113015: Add drupal_merge_attached() function, to merge #attached assets.drupal_merge_attached()
Comment | File | Size | Author |
---|---|---|---|
#33 | mark_all_simple-2221771-33.patch | 1.63 KB | Anonymous (not verified) |
#30 | interdiff.txt | 596 bytes | Eli-T |
#30 | mark_all_simple-2221771-30.patch | 2.07 KB | Eli-T |
#26 | 2221771-26.patch | 2.5 KB | rpayanm |
Comments
Comment #1
ianthomas_ukComment #2
Rolf van de Krol CreditAttribution: Rolf van de Krol commentedComment #3
Rolf van de Krol CreditAttribution: Rolf van de Krol commentedAll functions in the issue description are marked deprecated and instructions are added on what to use instead. Only
_current_path
I'm not sure what to use, so didn't add instructions there.Comment #4
Rolf van de Krol CreditAttribution: Rolf van de Krol commentedHmm, I see that I named the patch incorrectly. Sorry for that.
Comment #5
ParisLiakos CreditAttribution: ParisLiakos commentedLets leave t() there. Procedural code should still be able to translate stuff in a way that the string extractor finds them. Even if we end up with 0 usages in core (which i doubt) we cant force everyone to give up procedural code style
Besides that patch looks good
Comment #6
ianthomas_ukWe need to ensure these are all covered by change records (they probably aren't at the moment).
I agree it's best to leave t(), or at least discuss it in its own issue, so this patch does that. Needs review just so it gets tested.
Comment #7
ianthomas_uk: Covered by https://www.drupal.org/node/2302363 (7.x to 8.x) and https://drupal.org/node/1312890 (7.7 and earlier to 7.8+ and 8.x)format_string()
: Covered by https://www.drupal.org/node/1992584drupal_validate_utf8()
: Covered by https://www.drupal.org/node/2302363drupal_placeholder()
: Private, CR not applicable_current_path()
check_url()
: Not currently just a simple wrapper, but should really be moved to UrlHelper and covered by https://www.drupal.org/node/2079005: Covered by https://drupal.org/node/2239919filter_xss_admin()
: Covered by https://drupal.org/node/2239919filter_xss()
: Covered by https://drupal.org/node/2079005filter_xss_bad_protocol()
format_date()
: Covered by https://www.drupal.org/node/1876852, updates required to https://drupal.org/node/2047135, https://drupal.org/node/1831138 and https://drupal.org/node/1441334 (plus confirmation that the new function can be used from a twig template).: Covered by https://drupal.org/node/2079005url_is_external()
New CR needed means I couldn't find an existing CR that covers the change. It may be appropriate to extend an existing CR to cover that function. If a function is crossed out it means no CRs need to be added/updated.
Comment #8
ianthomas_ukActually, drupal_merge_*() should not be marked deprecated, see #2113015: Add drupal_merge_attached() function, to merge #attached assets. I've not bothered updating the patch, as there is little point until we have updated the change records.
Comment #9
xjmComment #10
xjmI think we need to leave them in until 9.x, or make this beta deadline.
Comment #11
xjmComment #12
xjmComment #15
ianthomas_ukremove
url()
from scopeComment #16
ianthomas_ukThe list in the issue summary is out of date. This patch deprecates the remaining functions mentioned, except:
-
url()
, because it is being handled in all four current beta blockers-
format_date()
, because I think it is needed for twig-
check_url()
, because it wasn't clear what it should be replaced with.The functions that this deprecates should be fairly uncontroversial, they are:
-
format_string()
-
drupal_validate_utf8()
-
_current_path()
-
drupal_placeholder()
Comment #17
xjm@ianthomas_uk, thanks!
Two points of feedback:
_current_path()
doesn't indicate what you should do instead, and there's no indication to me that "@todo This is a temporary function pending refactoring Drupal to use Symfony's Request object exclusively" was anything more than wishful thinking. Is there an issue for this?format_string()
) that have clear replacements, we should have filed the issue that will convert all remaining core usages to the replacement, and reference that issue link in the deprecation note.Comment #18
ianthomas_ukQuick response before I run out the door:
17.1 I figured because it was already a private function that wasn't really necessary, but I guess it wouldn't hurt.
17.2 That's not something that I've see us do elsewhere, but seems a good idea. Generally we've been tracking removals in #2205673: [META] Remove all @deprecated functions marked "remove before 8.0"
Comment #19
ianthomas_uk17.1 I've marked it clearly as an internal function and linked to its removal issue.
17.2 drupal_validate_utf8() and drupal_placeholder() only have a couple of uses, so I've just gone ahead and removed them. format_string() I've referenced the issue link.
Comment #20
rpayanmComment #21
rpayanmComment #22
xjmThanks @rpayanm and @ianthomas_uk!
Since I last reviewed this issue, we've entered beta. Reviewing in terms of the allowed beta changes policy (https://www.drupal.org/core/beta-changes), this patch would definitely qualify as disruptive (because hundreds of lines of core code would be using deprecated functions as a result). It is not a prioritized type of change, and it is correctly marked as a normal task.
So, now that we are in the beta phase, we should instead be marking functions for removal for 9.0.0 if they were not already deprecated when the first beta was released. (In general, and in this issue in particular.) In addition, some of the deprecations below do not have finalized replacements in HEAD, so we should not deprecate them here. Specific notes below:
Over 600 uses of this still in core. Let's deprecate this for removal in 9.0.0 instead.
This is not used
so we should have an issue to just remove it in a separate issue. Can you file a separate followup issue and reference it on this issue?Actually, even if core doesn't use it, contrib might, so let's apply the same logic and deprecate it for 9.0.0 instead.This is a whole can of worms. We also should not mark things deprecated that do already have replacements in HEAD. I'd remove this change from the patch entirely.
3 uses in HEAD. Let's deprecate this for removal in 9.0.0 instead.
16 uses in HEAD. Looks like this is incorrect text? Or at least we should be providing more information. Let's deprecate this for removal in 9.0.0 instead.
112 uses remaining. Let's deprecate this for removal in 9.0.0 instead.
Edit: removed comment that was about lines not in the patch. :P
Comment #23
xjmOh, regarding #19, it is out of scope to remove any code within this issue, but it looks like the latest patch in #21 reverted that.
Comment #25
Mile23Needs reroll.
Comment #26
rpayanmPlease review.
Comment #27
Mile23Just the fact that core currently uses a function doesn't mean it should not be deprecated for D9. I have a problem with deprecating for D9, because it really means "we won't actually deprecate this in any of our lifetimes."
Anyway, does this patch do what it says on the tin?
Yes.
Comment #28
xjmThanks @rpayanm, deprecating this for 9.0.0 is correct during the beta. Looks good. One more thing though:
As per #22 point 5, we need to add more detail to this documentation because
checkPlain()
is not a direct replacement forcheck_url()
.Also, just a note for @rpayanm -- you can include an interdiff when updating patches so that reviewer can spot the changes you've made from the previous patch easily. Thanks!
Comment #29
alexpottThis can't be deprecated like this. I don't think we can deprecate it yet. Let's just remove the deprecation notice for check_url() and move on.
Comment #30
Eli-TUndeprecate check_url().
Comment #31
DuaelFrNothing to add about that.
It does what it says.
Comment #32
DuaelFrSorry!
drupal_placeholder() is going to be marked as deprecated by #2552579: Remove SafeMarkup::placeholder(), deprecate drupal_placeholder() and stop drupal_placeholder() from marking safe. with a better comment. We should let that other issue manage this deprecation as it seems to be part of a bigger change.
Comment #33
Anonymous (not verified) CreditAttribution: Anonymous at XIO commentedThe patch didn't apply anymore, so rerolled.
Also removed drupal_placeholder() deprecation as per #32 and adjusted IS accordingly.
Comment #34
DuaelFrPerfect, thank you :)
It applies and do the job.
Let's get it commited!
Comment #35
alexpottThis is deprecating thing for Drupal 9 that have long been deprecated. Nice. Committed 5236486 and pushed to 8.0.x. Thanks!