In the Devel module, php E_NOTICE warnings are now exposed, in an attempt to tighten up coding practices and improve readability and reliability of contrib modules - #970688: How to treat E_NOTICE in backtrace_error_handler()? has the details.

The Update module in core produces a warning in update.fetch.inc when at least one module is out of date:

notice: Undefined index:  in end()
(line 257 of /Applications/MAMP/htdocs/HelpingYouHarmonise/modules/update/update.fetch.inc)

See the attached screen grab. I have a patch which I will attach here.

Jonathan

Comments

jonathan1055’s picture

StatusFileSize
new632 bytes

I have changed the line:

$this->current_object[strtolower($this->current_tag)] = trim($this->current_object[strtolower($this->current_tag)]);

to:

if ($this->current_tag != '') {
  $this->current_object[strtolower($this->current_tag)] = trim($this->current_object[strtolower($this->current_tag)]);
}

Here is a patch against 6.20. Does anyone know if this is an issue in D7?

jonathan1055’s picture

Status: Active » Needs review

Change status

carsten müller’s picture

StatusFileSize
new1.03 KB

Hi,

i have the same notice. I debugged it with the following lines

default:

        if (empty($this->current_tag)) {
          dvm('------------------');
          dvm($this->current_project['title']);
          dvm($this->current_release['name']);
          dvm($name);
          dvm($this->current_tag);
        }

        $this->current_object[strtolower($this->current_tag)] = trim($this->current_object[strtolower($this->current_tag)]);
        $this->current_tag = '';

When watching the debug prints you can see that the $name value is always "FILE" or "FILES". So the empty current_tag value appears when parsing the files.

The patch above works but i i think the follwing is a little bit better

if (!empty($this->current_tag) {
  $this->current_object[strtolower($this->current_tag)] = trim($this->current_object[strtolower($this->current_tag)]);
}
jonathan1055’s picture

Yes, using !empty is better, and you have removed someone else's trailing blank. Good.

dww’s picture