This fixes a few PHP Notices in 4.7 image.module when run with error reporting set to E_ALL.

The changes are designed to apply without changing any line numbering or any functional behaviour, in an attempt to be as separable as possible from other patches. It does mean many are of the form (isset($x) ? $x : NULL) which is not very pretty.

Example fixes:
(1) Changed
$form[$i]['label'] = array(..., '#default_value' => $sizes[$i]['label'], ...); into
$form[$i]['label'] = array(..., '#default_value' => isset($sizes[$i]['label']) ? $sizes[$i]['label'] : NULL, ...);

(2) Changed
if (in_array($sizes[$i]['label'], _image_required_sizes())) { to
if (!empty($sizes[$i]['label']) && in_array($sizes[$i]['label'], _image_required_sizes())) {

(3) Changed
return $form; to
return isset($form) ? $form : NULL; where $form may not have been defined.

(4) Changed
if ($node->new_file) { to
if (!empty($node->new_file)) {

Other changes are of a similar style to these.

I know this will probably only be of interest to Drupal historians, but I'm still running 4.7 for now...

Mark.

CommentFileSizeAuthor
#4 image_161063.patch4.52 KBdrewish
image.module.E_ALL.patch4.37 KBplumbley

Comments

drewish’s picture

could you roll a patch? http://drupal.org/patch

plumbley’s picture

I attached at the top what I hoped was a valid patch for current 4.7 image.module (image 4.7.1-1.x released 2 Mar 2007). The patch begins as follows:

Index: modules/image/image.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/image/image.module,v
retrieving revision 1.197.2.6
diff -u -r1.197.2.6 image.module
--- modules/image/image.module	1 Mar 2007 04:05:48 -0000	1.197.2.6
+++ modules/image/image.module	21 Jul 2007 13:09:33 -0000
@@ -81,13 +81,13 @@
...

Does this look OK? (I'm on Windows so I dos2unix'd the line endings, but use TortoiseCVS so haven't apply -p). Mark

drewish’s picture

totally my bad, for what ever reason the email notice i'd gotten didn't list the patch and i didn't double check before responding. i'll take a look at it.

drewish’s picture

StatusFileSize
new4.52 KB

one small change, don't bother testing that the form is set, only return it when it's set.

sun’s picture

Status: Needs review » Closed (won't fix)

Development and support for 4.7.x and 4.6.x has ended. You are strongly advised to upgrade to Drupal 5.x or 6.x.

Marking as won't fix.