Closed (fixed)
Project:
Storm
Version:
6.x-2.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
27 Jan 2011 at 21:36 UTC
Updated:
15 Jan 2012 at 22:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
juliangb commentedCould we accompany this with some tests to ensure that the errors are not reintroduced in the future?
Comment #2
pillarsdotnet commented@juliangb -- Yup. Go right ahead.
Comment #3
pillarsdotnet commentedlotsa-lotsa-lotsa undefined index errors thoughout the entire module. I care about PHP warnings, but I'm starting to lose steam after committing 12 hours to what should have been a 10-minute install.
Comment #4
juliangb commented@pilllarsdotnet, I also care about getting Storm free of PHP warnings, however, we need to structure the approach to patching in order that the fix remains and the effort is not wasted.
The way that we have done these so far is through adding tests - albeit some quite simple. These flag PHP warnings as exceptions, meaning that all future patches have to keep the same standards.
Whilst I will look at these patches for committing, it would be much more effective if you could collaborate on some of the following issues.
#918748: Tests for Storm Expense
#918752: Tests for Storm Team
#918750: Tests for Storm Timetracking
There are tests already for a number of the Storm modules, and so for these we can add lines that call particular pages - hence exposing any PHP warnings that appear when a user views those pages.
Comment #5
juliangb commentedWould it be possible to post a list of the paths of pages where you are seeing warnings?
I think then it will be easier to combine your patch with a few tests.
Comment #6
pillarsdotnet commentedThe only pages I tested were the sub-pages of the main "Storm" menu entry: (from memory), Organizations, People, Teams, Tickets, Tasks. And I ran out of motivation *way* before I ran out of errors. I don't use Storm, and I'm done for now with the customer who does.
To duplicate, set errorlevel to E_ALL and check the logs. If the original coders did this, then the errors would not have occurred in the first place. Sorry, but the following construct is annoyingly amateurish and ubiquitous, especially in Storm modules:
I haven't yet learned simpletest; sorry. I imagine you could just visit all of the defined module pages and check for dblog entries labeled "PHP" but I dunno.
Comment #7
rjgoldsborough commentedI was seeing many of these while working on #918748: Tests for Storm Expense and #918752: Tests for Storm Team, and I believe most of them are fixed with those two patches. If not all, a good deal of them at least.
Comment #8
juliangb commentedThe way I'm handling this is to add tests that call each page that Storm defines. This will show up any PHP warnings as exceptions. I'll then use the above patches to help solve those.
I'll post a few work in progress patches to ensure tests pass.
Comment #10
juliangb commentedComment #12
juliangb commentedComment #14
juliangb commentedComment #16
juliangb commentedComment #18
juliangb commentedComment #19
pillarsdotnet commentedThere are a lot of places where you change:
if ($foo) {to:
if (isset($foo)) {If this follows a statement like:
$foo = 0;then obviously
if (isset($foo))will evaluate toif (TRUE)whereasif ($foo)will evaluate toif (FALSE).In other words, your patch is based on the assumption that no tested variable is ever set to a value like FALSE, 0, or an empty string. They all are always either undefined, NULL, or set to a TRUE value.
I find it hard to reconcile such complete confidence in the code with the necessity of a 94-kilobyte patch.
Comment #20
juliangb commentedI looked at each change in its own merit -> therefore in some cases the change was the addition of an isset(), in other cases different methods of solving.
I should have also put a footnote, I have not added additional tests for Stormtimetracking or Stormteam. The former already has an issue looking at this, and the latter as there are changes going through which I'd like to get sorted first.
I'm going to leave this patch in the queue for a few days in case of query. Feel free to ask for clarification on specific changes if you have questions.
Comment #21
juliangb commented#18: storm--1042698-18.patch queued for re-testing.
Comment #22
juliangb commentedReroll using git.
Comment #23
rfayOK, just putting this in "needs work" to see if that will stop the continual retesting.
Comment #24
juliangb commented#22: storm--1042698-22.patch queued for re-testing.
Comment #25
juliangb commentedCommitted to 6.x-2.x.
Retest on 6.x-1.x.
Comment #26
juliangb commented#22: storm--1042698-22.patch queued for re-testing.
Comment #28
juliangb commentedAs I expected, will need a reroll for 1.x.
Comment #29
juliangb commentedThis patch should apply against 1.x - contains the test files. Hence should deliberately fail.
Comment #31
juliangb commentedConsidering the roadmap for moving priorities over to 2.x., I'd suggest we don't spend effort on migrating these tests to 1.x., and call this fixed now.
The tests are included in 2.x, so ongoing work and bug fix patches already in effect take account of them.