Fix some PHP notices on mailbox edit form

mfb - August 27, 2008 - 00:49
Project:Mailhandler
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

The mailbox add/edit form has some PHP notices about undefined indexes and undefined variables. The attached patch fixes the issue.

Part of the problem is missing default values for the mailbox form. I took a shortcut and used schema API to grab some defaults, but alternatively some explicit defaults could be defined.

Btw another thing I was looking at but didn't patch is the submit function for this form could probably use drupal_write_record().

AttachmentSize
mailhandler-admin.patch2.21 KB

#1

z.stolar - September 14, 2008 - 18:51
Status:needs review» needs work

The patch failed for me. Please re-roll.
Also, you might want to check out the 'cron' and 'security' radio buttons, which are stored as text, and so they are initialized to an empty string, while there should be something there.

Why did you choose to initialize the values through the DB, instead of setting them as part of the form?

#2

mfb - September 14, 2008 - 21:42

I just didn't know what the defaults should be (aside from what the schema defines). I can reroll it if/when I have more time to look at correct form defaults..

#3

mfb - September 14, 2008 - 22:48
Status:needs work» needs review

Here's a reroll with explicit defaults.

AttachmentSize
mailhandler-admin.patch 2.14 KB

#4

z.stolar - September 22, 2008 - 06:07

I'll try to put the same values as part of $form[...]['#default_value'] and will check it.

#5

z.stolar - October 26, 2008 - 17:55

Hi Mark,

I tried to recreate the notices, but I don't see anything.
I'm using PHP Version 5.2.4-2ubuntu5.3 with apache2, and PHP 'error_reporting = E_ALL'

#6

mfb - December 12, 2008 - 06:14

You may need to be using the dev version of Drupal to see the notices? See http://cvs.drupal.org/viewvc.py/drupal/drupal/includes/common.inc?r1=1.7...

#7

z.stolar - December 25, 2008 - 12:45

I tried again, I changed common.inc as necessary, but still no errors.
hmmm... I must be missing something, but I don't see what it is.

#8

mfb - December 26, 2008 - 00:07

Do you have Drupal set to display errors on the page? If not they might just be getting logged.

#9

eMPee584 - December 27, 2008 - 16:17
Priority:normal» critical
Status:needs review» reviewed & tested by the community

z put this into you index.php at the top:

error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

And you'll see loads of errors. Here are some more fixes, the patch includes the previous ones.

AttachmentSize
mailhandler-fixes.patch 6.78 KB

#10

z.stolar - April 27, 2009 - 19:07
Priority:critical» normal
Status:reviewed & tested by the community» needs review

eMPee584, you can't RTBC your own patch :-)... but I appreciate the effort!
It took me a while to get to this round of bug fixing, but I'm here at last.

Meanwhile I applied Mark's patch at #3, with few corrections. I would like to better inspect your proposed changes, eMPee584.

 
 

Drupal is a registered trademark of Dries Buytaert.