Comments

EndEd’s picture

subscribe

sillygwailo’s picture

Status: Active » Needs review
StatusFileSize
new553 bytes

Attaching a patch to check to see if $info['warn'] is set, and if not, pass an empty array to the foreach() loop.

3rdLOF’s picture

Patch worked for the line 614, put I get another error in line 633

Notice: Undefined index: extra in schema_compare() (line 633

sillygwailo’s picture

StatusFileSize
new754 bytes

Patch updated. I would have preferred a patch that doesn't display the extra fields box at all if there are none to display, but that messes with the weight ordering of the form elements.

KeesMK’s picture

The most recent build other line same problem this patch still solves this.

cmfeliz’s picture

StatusFileSize
new916 bytes

Hi everybody! I have this prblemes when i try to create table with hook_schema

Undefined index: warn in schema_compare() (line 614
Warning: Invalid argument supplied for foreach() in schema_compare() (line 615
Notice: Undefined index: extra in schema_compare() (line 623
Notice: Undefined index: extra in schema_compare() (line 633

somebody can help me, please.

thanks

3rdLOF’s picture

Patch fixes the problem.

3rdLOF’s picture

Try the patch above.

Jan_vStone’s picture

I fixed this in a slightly different way without noticing any drawbacks.

lyricnz’s picture

StatusFileSize
new997 bytes

No point in looping and unset() if there are no warnings - used an conditional block. Used [extra] code from #4.

geerlingguy’s picture

Status: Needs review » Needs work

Still getting one more warning (with patch #10 above):

Notice: Undefined index: extra in schema_compare() (line 624 of ~/drupal/sites/all/modules/schema/schema.module).

There's one more place we need to handle the empty condition in the 'extra' fieldset...

karschsp’s picture

Status: Needs work » Needs review

@geerlingguy I'm not getting that warning with the patch in #10. Can anyone else confirm? Thanks!

geerlingguy’s picture

Status: Needs review » Reviewed & tested by the community

I haven't been getting the warning since posting the earlier comment. Back to RTBC.

wim leers’s picture

Patch tested, confirming RTBC.

karschsp’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Committed to 7.x-1.x.

Thanks!

wim leers’s picture

Hurray :)

BeaPower’s picture

I am having this problem in 7.x-1.0-beta3, will the patch still apply?

karschsp’s picture

@BeaPower. Should still apply, or just download 7.x-1.x-dev

cmfeliz’s picture

Thanks for your answer it's work

flak’s picture

I think we need to make one more tiny change on or about line 630:

  foreach ($warnings as $message) {
     drupal_set_message($message, 'warning');
  }
  //unset($info['warn']);

  $form['extra'] = array(
     '#type' => 'fieldset',
-    '#title' => t('Extra (@count)',
-        array('@count' => count($info['extra']))),
+   '#title' => t(
+	'Extra (@count)',
+	array(
+	   '@count' => count( 
+		isset($info['extra']) ? 
+		$info['extra'] : 
+		array() 
+	   )
+	)
+   ),
    '#description' => t('Tables in the database that are not present in the schema.  This
        indicates previously installed modules<code> that are disabled but not un-installed or
flak’s picture

Status: Closed (fixed) » Needs review
fgm’s picture

Status: Needs review » Needs work

Nitpicks:

  • why leave a commented-out //unset line ?
  • indenting does not honor drupal coding standards
casperovich’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta3

Hi all,
My solution:
in line 615:

$warnings = $info['warn'];  
    foreach ($warnings as $message) {
      drupal_set_message($message, 'warning');
    }
unset($info['warn']);

replace by:

 if(isset($info['warn'])){
    $warnings = $info['warn'];  
    foreach ($warnings as $message) {
      drupal_set_message($message, 'warning');
    }
      unset($info['warn']);
  }

That all.

rudyard55’s picture

Subscribed.

Notice: Undefined index: warn in schema_compare() (line 614 of J:\Sites\Example\sites\all\modules\schema\schema.module).
Warning: Invalid argument supplied for foreach() in schema_compare() (line 615 of J:\Sites\FPD_Portal\sites\all\modules\schema\schema.module).
Notice: Undefined index: extra in schema_compare() (line 623 of J:\Sites\Example\sites\all\modules\schema\schema.module).
Notice: Undefined index: extra in schema_compare() (line 633 of J:\Sites\Example\sites\all\modules\schema\schema.module)

casperovich’s picture

Status: Needs work » Needs review

Please Try to check if $info['extra'] isset.

$form['extra'] = array(
    '#type' => 'fieldset',
    '#title' => t('Extra (@count)',
        array('@count' => count($info['extra']))),  
    '#description' => t('Tables in the database that are not present in the schema.  This
        indicates previously installed modules that are disabled but not un-installed or
        modules that do not use the Schema API.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#weight' => 50, // This goes last
  );
  $form['extra']['tablelist'] = array(
    '#theme' => 'item_list',
    '#items' => $info['extra'],
  );
  unset($info['extra']);

REPLACE BY

if (isset($info['extra'])) {
  $form['extra'] = array(
    '#type' => 'fieldset',
    '#title' => t('Extra (@count)',
        array('@count' => count($info['extra']))),  
    '#description' => t('Tables in the database that are not present in the schema.  This
        indicates previously installed modules that are disabled but not un-installed or
        modules that do not use the Schema API.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#weight' => 50, // This goes last
  );
  $form['extra']['tablelist'] = array(
    '#theme' => 'item_list',
    '#items' => $info['extra'],
  );
  unset($info['extra']);
}
colan’s picture

Status: Needs review » Needs work

I don't see a recent patch here. Please provide code changes in patch format so that they may be properly reviewed and tested.

geerlingguy’s picture

Is this even a problem anymore? I think it should be fixed in the -dev version...

colan’s picture

Status: Needs work » Closed (fixed)

Let's assume so. If this is still a problem, please reopen against 7.x-1.0-beta4, released today.