Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
15 Jan 2010 at 05:08 UTC
Updated:
7 Jun 2024 at 17:20 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
carlos8f commentedThis is partially inspired by #684138: DatabaseConnection_sqlite->dbNextId() always returns NULL, breaking batch api, installation, where the SQLite db_next_id() implementation was completely broke and no one noticed. The implementation returned an undefined variable, and it was obvious that someone had just copied and pasted the code and not tested it.
Undefined variables are easy to spot with software, any decent IDE should point them out. In some cases they are harmless and in others fatal, so I think it's not something to ignore. It also suggests that our test coverage is lacking in these spots.
Comment #3
carlos8f commentedNote that I'm pre-defining variables in some cases where it isn't really necessary, but this is to assist in auto-detecting accidentally undefined variables. Most software isn't smart enough to check included files or compute an extract() call.
Comment #4
dries commentedInteresting. Lots of things to clean-up it seems. By the way, we tend to write @todo instead of just TODO.
Comment #5
casey commentedNeeds a reroll.
Comment #6
Blooniverse commentedMaybe my little story is of interest for you?:
In order to get some metatags into Drupal7 (no nodewords, no meta tag module available yet) I typed the following code into Bartik's page.tpl.php, just on top of everything else:
The result is, every now and then (means: sometimes things are okay, sometimes not):
Comment #7
pasqualledrupal-undefined-variables.patch queued for re-testing.
Comment #8
poker10 commentedThanks for working on this. This still Needs work, as there are open @todos. Also the patch does not apply anymore.