Issue #3471696: DomainConfigUIManager strlen Passing null to parameter error
Merge request reports
Activity
added 3 commits
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/YkRxFRfEdited by dqd@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.
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/YkRxFREdited by dqd@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