release.inc produces various PHP Notices with E_ALL on. These are all due to variables, array keys or object fields which may not exist when used.
This patch fixes those that I spotted, by changing to equivalent behaviour without Notices.
Exception: Example 4 below changed to remove unwanted database query when creating a new release (and $rid->nid is not set).
Examples:
1.
switch ($_POST['op'] ? $_POST['op'] : arg(3)) {
changed to
switch (!empty($_POST['op']) ? $_POST['op'] : arg(3)) {
2.
'#default_value' => $release->version,
changed to
'#default_value' => isset($release->version) ? $release->version : NULL,
3. Added
$output = '';
in project_release_view() and project_release_list(), that may use it later.
4. In function project_release_load() changed
if ($rid->type == 'project_project') {
...
$result = db_query("SELECT rid,version FROM {project_releases}
WHERE nid = %d $status ORDER BY version DESC", $rid->nid);
to
if ($rid->type == 'project_project' && !empty($rid->nid)) {
...
$result = db_query("SELECT rid,version FROM {project_releases}
WHERE nid = %d $status ORDER BY version DESC", $rid->nid);
since $rid->nid is not set on creation.
| Comment | File | Size | Author |
|---|---|---|---|
| release.inc_2.patch | 2.81 KB | plumbley |
Comments
Comment #1
plumbley commented(Setting correct status.)
Comment #2
drewish commenteddoesn't apply to 5. i don't know if dww is still committing to 4.7 but i'm not really into setting up an old test site.
Comment #3
hunmonk commentedfixed in 4.7.x-1.x
this code changed so drastically in 4.7.x-2.x that i can't even locate these sections of code, so i won't apply this patch forward -- we'll just have to root out any of these in separate issues.
Comment #4
(not verified) commented