Run a drupal-check against current Tablefield 8.x-2.x development release (28 Apr 2019).
------ ---------------------------------------------------
Line src\Element\Tablefield.php
------ ---------------------------------------------------
276 Call to deprecated function drupal_set_message().
311 Call to deprecated function drupal_set_message().
337 Call to deprecated function drupal_set_message().
341 Call to deprecated function drupal_set_message().
------ ---------------------------------------------------
------ -------------------------------------------------------------------------------
Line src\Form\TablefieldConfigForm.php
------ -------------------------------------------------------------------------------
76 Call to deprecated method strlen() of class Drupal\Component\Utility\Unicode.
------ -------------------------------------------------------------------------------
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | drupal_9_deprecated_code_report-3062227-2.patch | 2.42 KB | eric heydrich |
Comments
Comment #2
eric heydrichChanged all errors and rerun drupal-check with no errors.
Comment #3
lolandese commentedThe patch applies cleanly:
Patch solves the errors:
Manual test to trigger the changed code to check correct functionality BEFORE and AFTER the patch:
At admin/config/content/tablefield "CSV separator" that must be one character only cannot be tested as on the form
'#maxlength' => 1,. We believe that validation on it can be removed. As it was present also before, it is no blocker for committing the patch though.Comment #5
lolandese commentedRelated Change record:
drupal_get_message() and drupal_set_message() replaced by Messenger service | Drupal.org
API:
MessengerInterface | MessengerInterface.php | Drupal 8.7.x | Drupal API
Looking at 8 - Best practice: $this->t() versus t() - Drupal Answers it seems we should rather use
$this->t(). As is was already there, this is also no blocker. Opening new issues for the findings.Comment #6
lolandese commentedAdded some follow-up issues.
Thanks for your contribution,
Comment #7
lolandese commentedSeems that not all PHP version support this yet out-of-the-box.
Error: Call to undefined method Drupal\Component\Utility\Unicode::mb_strlen() in Drupal\tablefield\Form\TablefieldConfigForm->validateForm() (line 76 of /var/www/html/brown.localhost/web/modules/tablefield/src/Form/TablefieldConfigForm.php)
Comment #8
eric heydrichCan you please provide some more information on PHP Version and Drupal Version tested. Mbstring has to be activated or there is a polyfill for mbstring in Symfony since D8.6. More info here: https://www.drupal.org/node/2850048. Maybe older versions than drupal 8.6 don't have the polyfill.
Comment #9
lolandese commentedDrupal Version
8.7.3
PHP
Version
7.2.19-1+ubuntu18.04.1+deb.sury.org+1
But it seems normal that the extension might be needed to be added:
php - Fatal error: Call to undefined function mb_strlen() - Stack Overflow
Comment #10
lolandese commentedThe #7 error will not occur anymore as the validation function has been removed in #3064974: Unnecessary validation function. Thanks.
Comment #12
eric heydrich