Store Install Error--Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$'--LINE 2166

Dustin Boston - March 25, 2007 - 00:10
Project:e-Commerce
Version:5.x-3.x-dev
Component:store
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I get the following error when I try to install the store module (I am installing it according to the install instructions here http://drupal.org/node/50364):

Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in
[ed.]sites/default/modules/ecommerce/store/store.module on line 2166

This line refers to the following function:

<?php
function _store_array_distinct($array, $sub_key) {
 
$target = array();
 
$existing_sub_key_values = array();
  foreach (
$array as $key => $sub_array) {
//line 2166 below, offending line:
   
if (!in_array($sub_array[$sub_key], $existing_sub_key_      )) {
      $ 
isting_sub_key_values[] = $sub_array[$sub_key];
     
$target[$key] = $sub_array;
    }
  }

  return
$target;
}
?>

The line that calls the method is line 1747:
    $header = _store_array_distinct($table, 'data');

So the error is occurring because of the 'data' string that is being passed in. I imagine that it's not part of the table array but I'm not sure what's going on with that.

#1

Dustin Boston - March 25, 2007 - 00:40

I was able to fix the problem but I'm not sure why it worked. I just put a die(); before the offending line, stopped execution of the script and it installed properly, although I didn't test the integrity of the install. I then disabled the store module, reverted back to the original code, and re-enabled it and it installed just fine.

My guess: maybe my tables were messed up and were fixed by killing the script and disabling the module. I think the first time through I just went through and started checking things.

The install text on this post (http://drupal.org/node/50364) was really what helped me to clarify. Maybe the information about installing in stages could be added to the README.txt. See attached.

AttachmentSize
README_9.txt 6.93 KB

#2

brmassa - July 11, 2007 - 21:20
Status:active» closed

#3

kmarchand - September 18, 2009 - 18:39

Parse error: syntax error, unexpected T_STRING in /var/www/website-name/htdocs/drupal-6.13/includes/common.inc(1655) : eval()'d code on line 13.

Need help. I am new to this and getting an error for trying to use the following for tabs.

<?php
  $form
= array();

 
$form['example1'] = array(
   
'#type' => 'tabset',
  );
 
$form['example1']['tab1'] = array(
   
'#type' => 'tabpage',
   
'#title' => t('Description'),
   
'#content' => t('
    <br /><span>Hello</span><br />
'
),
  );
 
$form['example1']['tab2'] = array(
   
'#type' => 'tabpage',
   
'#title' => t('Specifications'),
   
'#content' => t('
<br /><br />
    '
),
  );
 
$form['example1']['tab3'] = array(
   
'#type' => 'tabpage',
   
'#title' => t('Accessories'),
   
'#content' => t('
    <br /><br />'
),
  );

  return
tabs_render($form);
?>

#4

kmarchand - September 18, 2009 - 19:07

Funny that it will work on other items but two that are not.

 
 

Drupal is a registered trademark of Dries Buytaert.