Skip to content
Snippets Groups Projects

Issue #3471696: DomainConfigUIManager strlen Passing null to parameter error

Open Issue #3471696: DomainConfigUIManager strlen Passing null to parameter error
2 unresolved threads
2 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
40 40 */
41 41 public function getSelectedConfigName($name, $omit_language = FALSE) {
42 42 $domain_id = $this->getSelectedDomainId();
43 $is_valid_domain_id = !is_null($domain_id) && $domain_id !== '';
43 44
44 if (!is_null($domain_id)) {
45 if ($is_valid_domain_id) {
  • Like the idea of $is_valid_domain_id = !is_null($domain_id) && $domain_id !== ''; if ($is_valid_domain_id) { for code readability. Question, which is not meant to cast doubt, just to make sure that's what we want: https://3v4l.org/h0VeB visual: https://ibb.co/YkRxFRf

    Edited by dqd
  • Author Contributor

    @dqd, yes, this is exactly the behavior we expect. It all comes down to a basic check - not null and not empty string. Numbers and booleans will be converted to strings in the next step.

  • Please register or sign in to reply
  • dqd
    dqd @dqd started a thread on commit bbd2c071
  • 44 44 if (!is_null($domain_id)) {
    45 45 $prefix = "domain.config.{$domain_id}.";
    46 46 $langcode = $this->getSelectedLanguageId();
    47 if (!$omit_language && !is_null($langcode)) {
    47 $is_valid_langcode = !is_null($langcode) && $langcode !== '';
    48 if (!$omit_language && $is_valid_langcode) {
    • Same question here: Like $is_valid_xxx for readability in conjunction with the other checks very much. Just to make sure that's what we want: Question, which is not meant to cast doubt, just to make sure that's what we want: https://3v4l.org/h0VeB visual: https://ibb.co/YkRxFR

      Edited by dqd
    • Author Contributor

      @dqd, yes, this is exactly the behavior we expect. It all comes down to a basic check - not null and not empty string. Numbers and booleans will be converted to strings in the next step.

    • Won't it be enough just to cast language value to string?

      before:

      $langcode = $this->getSelectedLanguageId();

      after:

      $langcode = (string) $this->getSelectedLanguageId();

      then it should not throw error "Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated" on this line:

      if (!$omit_language && strlen($langcode) > 0) {

      Edited by Oleksandr Yushchenko
    • Please register or sign in to reply
    Please register or sign in to reply
    Loading