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.
| Attachment | Size |
|---|---|
| hierarchical_select-fix-php-notices.patch | 5.67 KB |

#1
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
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
#3
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
Dammit, this patch consists of very simple changes and therefor I went ahead and committed it. But apparently this broke HS.
#5
Fixed again: http://drupal.org/cvs?commit=281956. Also fixed another notice at the same time.
#6
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
Good find. Thanks! Will commit ASAP.