PHP undefined variable notices

eMPee584 - August 18, 2009 - 22:29
Project:Hierarchical Select
Version:6.x-3.x-dev
Component:Code
Category:task
Priority:minor
Assigned:Wim Leers
Status:reviewed & tested by the community
Description

please add

<?php
error_reporting
(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
?>

to your settings.php to show all these PHP warnings (if your server is not already configured to do so) and test a bit around.

AttachmentSize
hierarchical_select-fix-php-notices.patch5.67 KB

#1

Wim Leers - October 6, 2009 - 19:19
Title:php undefined variable notices» PHP undefined variable notices
Category:bug report» task
Priority:normal» minor

Configuring settings.php is not sufficient apparently (I had done that a long time ago already and had given up because I didn't get to see any notices).

You must also patch Drupal core: it won't show E_NOTICE errors out-of-the-box. Stupid!

I'll review your patch ASAP :)

#2

Wim Leers - October 30, 2009 - 18:50
Assigned to:Anonymous» Wim Leers
Status:needs review» fixed

I fixed all notices that I could find/produce. I'm sure there are more, although most notices should be fixed now. I've based my patch on your changes, but changed some of your modifications and added many, many more fixes.

http://drupal.org/cvs?commit=281808

AttachmentSize
552910-2.patch 17.75 KB

#3

Wim Leers - October 30, 2009 - 18:52

Oh and the changes to core that are necessary: in common.inc, change:
  if ($errno & (E_ALL ^ E_NOTICE ^ E_DEPRECATED)) {
to:
  if ($errno & (E_ALL ^ E_NOTICE | error_reporting())) {

#4

Wim Leers - October 30, 2009 - 22:43
Status:fixed» needs work

Dammit, this patch consists of very simple changes and therefor I went ahead and committed it. But apparently this broke HS.

#5

Wim Leers - October 30, 2009 - 23:28
Status:needs work» fixed

Fixed again: http://drupal.org/cvs?commit=281956. Also fixed another notice at the same time.

#6

jrao - November 8, 2009 - 02:54
Status:fixed» needs work

This fix introduced an error in hs_taxonomy.module:

@@ -135,14 +135,14 @@ function hs_taxonomy_form_taxonomy_form_
       'status'   => 1,
     ),
     'params' => array(
-      'vid'         => $form['vid']['#value'],
-      'exclude_tid' => $form['tid']['#value'],
+      'vid'         => isset($form['tid']['#value']) ? $form['vid']['#value'] : NULL,
+      'exclude_tid' => isset($form['tid']['#value']) ? $form['tid']['#value'] : NULL,
       'root_term'   => TRUE,
     ),
   );

I think you meant to use:

'vid'         => isset($form['vid']['#value']) ? $form['vid']['#value'] : NULL,

Otherwise the parent and related terms in new terms form will always be empty.

#7

Wim Leers - November 9, 2009 - 11:08
Status:needs work» reviewed & tested by the community

Good find. Thanks! Will commit ASAP.

 
 

Drupal is a registered trademark of Dries Buytaert.