It's standard Drupal practice to develop so that E_NOTIFY does not emit any messages unless there are real problems...

I just installed Storm and got a flurry of messages:



    * notice: Undefined property: stdClass::$nid in /home/rfay/workspace/d6git/sites/all/modules/storm/stormorganization/stormorganization.module on line 431.
    * notice: Undefined property: stdClass::$nid in /home/rfay/workspace/d6git/sites/all/modules/storm/stormproject/stormproject.module on line 627.
    * notice: Undefined property: stdClass::$nid in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 796.
    * notice: Undefined property: stdClass::$nid in /home/rfay/workspace/d6git/sites/all/modules/storm/stormticket/stormticket.module on line 656.
    * notice: Undefined index: stormtask_list_filter in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 451.
    * notice: Undefined index: stormtask_list_filter in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 454.
    * notice: Undefined property: stdClass::$organization_nid in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 486.
    * notice: Undefined property: stdClass::$organization_nid in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 496.
    * notice: Undefined property: stdClass::$project_nid in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 505.
    * notice: Undefined property: stdClass::$project_nid in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 514.
    * notice: Undefined property: stdClass::$project_nid in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 517.
    * notice: Undefined offset: 0 in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 884.
    * notice: Undefined variable: tree in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 897.
    * notice: Undefined property: stdClass::$parent_nid in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 522.
    * notice: Undefined property: stdClass::$weight in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 530.
    * notice: Undefined property: stdClass::$stepno in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 538.
    * notice: Undefined property: stdClass::$duration in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 629.
    * notice: Undefined property: stdClass::$price in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 650.
    * notice: Undefined property: stdClass::$organization_nid in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 667.
    * notice: Undefined property: stdClass::$project_nid in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 667.
    * notice: Undefined index: People: in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 940.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 940.
    * notice: Undefined index: Teams: in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 943.
    * warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 943.
    * notice: Undefined index: People: in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 946.
    * notice: Undefined index: Teams: in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 949.
    * notice: Undefined property: stdClass::$assigned_nid in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 673.
    * notice: Undefined property: stdClass::$stepno_old in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 682.
    * notice: Undefined property: stdClass::$title_old in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 687.
    * notice: Undefined index: #type in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 787.
    * notice: Undefined index: #type in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 787.
    * notice: Undefined index: #attributes in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 788.
    * notice: Undefined index: #attributes in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 788.
    * notice: Undefined index: #attributes in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 788.
    * notice: Undefined index: #type in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 787.
    * notice: Undefined index: #type in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 787.
    * notice: Undefined index: #type in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 787.
    * notice: Undefined index: #type in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 787.
    * notice: Undefined index: #type in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 787.
    * notice: Undefined index: #attributes in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 788.
    * notice: Undefined index: #type in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.module on line 787.
    * notice: Undefined variable: output in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.theme.inc on line 16.
    * notice: Undefined variable: output in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.theme.inc on line 16.
    * notice: Undefined variable: output in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.theme.inc on line 16.
    * notice: Undefined variable: output in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.theme.inc on line 16.
    * notice: Undefined variable: output in /home/rfay/workspace/d6git/sites/all/modules/storm/storm.theme.inc on line 16.
    * notice: Undefined index: n in /home/rfay/workspace/d6git/sites/all/modules/storm/stormorganization/stormorganization.module on line 109.
    * notice: Undefined index: n in /home/rfay/workspace/d6git/sites/all/modules/storm/stormproject/stormproject.module on line 180.
    * notice: Undefined index: n in /home/rfay/workspace/d6git/sites/all/modules/storm/stormtask/stormtask.module on line 167.
    * notice: Undefined index: n in /home/rfay/workspace/d6git/sites/all/modules/storm/stormticket/stormticket.module on line 171.

Comments

Magnity’s picture

Category: task » bug

Which version of PHP are you on?

And would you be able to write a patch for any of these?

rfay’s picture

Thanks for the quick response.

This is php 5.2.6.

If I end up using the module, I'll write a patch, but I'm still evaluating various alternatives. Normally resolving this level of warnings requires a concerted effort by the developer to always work with E_NOTIFY turned on and use php5 coding standards, since it pops up all over if you haven't declared variables before appending to them, etc.

Thanks for your contribution to the community!

rfay’s picture

Title: Fix E_NOTIFY notifications » Fix E_NOTICE notifications
juliangb’s picture

PHP 5.2.11, server set to E_ALL - unable to reproduce at the moment.

naught101’s picture

Also getting this - huge numbers of notices.

@juliangb: are errors set to display on screen at admin/settings/error-reporting ?

juliangb’s picture

naught101 - i'll have another look when i have time.

Could you write a patch for this?

naught101’s picture

juliangb: I'm in the same boat as rfay - still figuring out whether we will use this module. As it stands, there appears to be notices coming from most modules, and it would require someone who is as least a little bit familiar with the code to deal with these problems. Which I'm not.

Also, if you're not able to see the errors on screen, they might appear in the error log at admin/reports/dblog

juliangb’s picture

Priority: Normal » Critical

This is now critical as the notices are being caught as exceptions in the test bot. We need to fix them to ensure that each time we test it is against an absolutely clean version.

tchurch’s picture

I'm not promising that I can do this (might be out of my comfort zone) but because it's stopping all other commits, I'll put all my time into trying to create a patch.

If anyone else can do it faster then please do.

:)

tchurch’s picture

Assigned: Unassigned » tchurch
Status: Active » Needs review
StatusFileSize
new648 bytes

A first upload to check it actually fixes something.

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new648 bytes

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new745 bytes

Trying with Cygwin instead of TortoiseCVS (stupid diff options).

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new1.12 KB

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

JGonzalez’s picture

That's a lot nicer! I was going to get my hands dirty and try these but seems like are you almost done!

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new2.92 KB
tchurch’s picture

#19: 684016.patch queued for re-testing.

tchurch’s picture

I haven't made very many changes to the code and yet all the errors have gone.
Can someone check this over before I commit it?

tchurch’s picture

StatusFileSize
new2.92 KB

Slight correction after a test.

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

tchurch’s picture

Status: Needs work » Needs review

#19: 684016.patch queued for re-testing.

tchurch’s picture

StatusFileSize
new5.84 KB

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new6.68 KB

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new6.83 KB

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new10.31 KB

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new11.27 KB

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new11.31 KB

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new11.25 KB

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

juliangb’s picture

Seems to be on the right path. Sorry I can´t help with this issue as I am currently abroad.

I should emphasise to those who are looking for this issue to fix notices they see on the screen / logs, that this will not fix all simply by seeing all tests pass - it only fixes the code the tests run. Surely a reason to increase the number of tests we run!

The 1 test fail in the latest patch seems to be an incorrect argument passed to a function_exists().

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new17.36 KB

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

tchurch’s picture

Status: Needs work » Needs review

#40: 684016.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

tchurch’s picture

Well, now I'm a bit stuck with this last error (if it is the last one).

juliangb’s picture

Unless someone can throw light on this, perhaps we should comment out that assertion in the test file as a temporary measure to get the tests passing.

A few comments on the patch. I don´t have dreditor here so can´t easily be too specific, but there are a few code style points we should try to stick with:
- Capital letters for NULL
- isset($node->reference) ? $node->reference : NULL instead of !isset($node->reference) ? null : $node->reference
- New lines when the full if() is used rather than ?

Other than that, it looks RTBC.

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new18.1 KB

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

tchurch’s picture

Why is it that different test clients give different results? Stuipid.

Nearly there though.

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new18.63 KB

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new19.45 KB

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

juliangb’s picture

Almost there!

Can anyone help tchurch out by helping out with this? This patch will benefit everyone.

It occured to me about the failing test (now commented out), that we should try manually creating a project, as this is the test that failed - perhaps an error occurs.

Current patch looks good to me - RTBC once those last 4 exceptions have been eliminated.

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new20.56 KB

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new21.71 KB
tchurch’s picture

Can someone test this patch and make sure it still is OK?

I'll also try and test it but I'm on a 2 week holiday soon.

JGonzalez’s picture

I'll do a little testing on it although I'll be going on a 2 month holiday soon as well - Hello Virgin Islands. :-)

tchurch’s picture

I've done some testing on it this morning (before breakfast :) ) and I'll continue to try and break it.

I'm using Drupal 6.17 with the latest Storm -dev (11-july) and applied the patch to this.

I've done the following tests:
- add new org
- add new project to new org
- add new task to new project
- add timetrackings to org and project
- create invoice from timetracking (adding both timetracking records).
- create manual invoice with 2 lines.
- edited invoice, adding new line and altering existing line.

All seems OK so far.

tchurch’s picture

I'd like to commit this patch to -dev today so that I can update and retest my other patches tomorrow before I go on holiday.
What do people think?

dbt102’s picture

GO FOR IT.

JGonzalez’s picture

I've applied the patch and have also been messing with it - I've done most of the things you've done as well and all is fine here. Will try to do other things and break it somehow.

From a quick glance at the patch (awesome work TChurch btw), everything seems ok.

RTBC in my opinion.

tchurch’s picture

StatusFileSize
new22.35 KB

Added comment into changelog file.

Status: Needs review » Needs work

The last submitted patch, 684016.patch, failed testing.

tchurch’s picture

Status: Needs work » Needs review
StatusFileSize
new22.29 KB

I don't believe it.

tchurch’s picture

Status: Needs review » Fixed

I have committed these changes before anything else goes wrong.

sethcohn’s picture

Nice! Thank you SO much for your hard work on this!

juliangb’s picture

Thanks tchurch for getting this sorted.

I´ve opened #870428: Reinstate commented out test assertion to tackle putting the test assertion back.

We can handle any other PHP notices that are found in separate issues.

Also marking #619310: PHP warning messages saving project with PHP 5.3.0 as a duplicate of this pending more info.

Status: Fixed » Closed (fixed)

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