Problem/Motivation

Most functions in unicode.inc already have a proper replacement so let's mark those functions as deprecated.

Proposed resolution

Remaining tasks

User interface changes

API changes

Comments

Noe_’s picture

StatusFileSize
new0 bytes

I added the @deprecated comments on all functions including a @see and another function.

Noe_’s picture

Status: Active » Needs review
berdir’s picture

Status: Needs review » Needs work

Patch file is empty.

The last submitted patch, 1: 2350437-1.patch, failed testing.

rpayanm’s picture

Assigned: Unassigned » rpayanm
Status: Needs work » Needs review
StatusFileSize
new4.74 KB

Working on this...

penyaskito’s picture

Status: Needs review » Needs work
+++ b/core/includes/unicode.inc
@@ -123,7 +123,8 @@ function drupal_xml_parser_create(&$data) {
+ * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.

@@ -145,7 +146,8 @@ function drupal_convert_to_utf8($data, $encoding) {
+ * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.

@@ -185,7 +187,8 @@ function drupal_truncate_bytes($string, $len) {
+ * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.

@@ -201,7 +204,8 @@ function truncate_utf8($string, $max_length, $wordsafe = FALSE, $add_ellipsis =
+ * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.

@@ -217,7 +221,8 @@ function mime_header_encode($string) {
+ * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.

@@ -263,7 +270,8 @@ function drupal_strlen($text) {
+ * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.

@@ -279,7 +287,8 @@ function drupal_strtoupper($text) {
+ * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.

@@ -292,10 +301,11 @@ function drupal_strtolower($text) {
+ * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.

@@ -312,10 +322,11 @@ function drupal_ucfirst($text) {
+ * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.

Should say 8.0.0

rpayanm’s picture

StatusFileSize
new4.75 KB

@penyaskito thank you ;)
here the patch :D

rpayanm’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 7: 2350437-7.patch, failed testing.

hussainweb’s picture

Status: Needs work » Needs review
StatusFileSize
new4.17 KB
new4.76 KB

I think it's just a random failure, but I am updating the comments to add a period at the end.

penyaskito’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Quickfix

Checked that the comments are according to other deprecations, and the version is correct.

rpayanm’s picture

Assigned: rpayanm » Unassigned
alexpott’s picture

  • drupal_convert_to_utf8 1
  • drupal_truncate_bytes 0
  • truncate_utf8 18
  • mime_header_encode 3
  • mime_header_decode 0
  • decode_entities 29
  • drupal_strlen 21
  • drupal_strtoupper 4
  • drupal_strtolower 87
  • drupal_ucfirst 5
  • drupal_substr 17

This patch signs us up to quite a bit of work removing all the usages of the above functions. Just thinking aloud - do we really want to do this?

ianthomas_uk’s picture

These functions have been replaced by newer versions, so that are already de-facto deprecated, they just aren't marked as such, so people won't know not to use them in new code.

Your question then becomes do we want to remove the functions before D8 or before D9?

I say we do it now. We should be able to replace most of these with the script on #2208607: Write script to automate replacement of deprecated functions where possible and if we don't deprecate them now then people will be writing new code with them years from now. There's good progress being made on the existing 'remove uses' issues, and it's much easier to push their removal back from D8 to D9 than pull it forward from D9.

Even if we don't mark these for removal before D8, we should still remove their uses, so that when people copy code from core they are using the up to date form of the functions.

I've linked the relevant change record to this issue.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Okay let's do this - talked about with @catch and he thinks this is good to do.

Committed 05eb791 and pushed to 8.0.x. Thanks!

  • alexpott committed 05eb791 on 8.0.x
    Issue #2350437 by rpayanm, hussainweb, Noe_ | dawehner: Mark unicode.inc...

Status: Fixed » Closed (fixed)

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