Page 1 of 1

PostPosted: Fri Oct 13, 2006 2:54 am
by ferrante
Hi.

I have create one application composed by many tables. The main one has many relathionships with the others defined in valuelists.ini as __sql__ = "SELECT fieldid, field FROM table ORDER BY field".

It has worked perfectly until recently. When listing or editing the main table, an error message shows:

Warning: Invalid argument supplied for foreach() in /home/www/dataface/Dataface/Table.php on line 835

I have revised Table.php, but no clue. The tables seem to be OK, so I don't know what happened. Everything else works perfectly, except that when I try to save a new or edited record, it says:

Warning: Invalid argument supplied for foreach() in /home/www/dataface/Dataface/Table.php on line 835

Warning: Cannot modify header information - headers already sent by (output started at /home/www/dataface/Dataface/Table.php:835) in /home/www/dataface/actions/edit.php on line 167

And I have to go back with the browser. However, I see that the records are saved correctly.

Just in case it is of help, the position of the message error in the page is:

List view: between the menus and the results list.

Details view: within the cell of one of the listed fields. Concretely, this field is a widget:type=select, related to other table, but that other table seems to be OK.

Other views (search, add or edit record, etc.): top of the page, before the header.

Greetings

PostPosted: Fri Oct 13, 2006 9:20 am
by shannah
Hi Felipe,

Which version of Dataface are you running... when I go to line 835 in my version of Table.php it is a comment block - so yours must be different. Can you open Table.php, go to line 835 and copy and paste that line into the forum so that I can take a look at where this error is happening?

Thanks

Steve

PostPosted: Wed Oct 18, 2006 6:34 am
by ferrante
Hi.
I'm pasting lines 823-840. Line 835 contains the foreach statement.
I'm using version 0.6.2.
Greetings.
Felipe

// we import the values from another value list. The value of this
// entry should be in the form tablename.valuelistname
list( $ext_table, $ext_valuelist ) = explode('.', $value);
if ( isset( $ext_table ) && isset( $ext_valuelist ) ){
$ext_table =& Dataface_Table::loadTable($ext_table, $this->db);
} else if ( isset( $ext_table ) ){
$ext_valuelist = $ext_table;
$ext_table =& $this;
}

if ( isset( $ext_table ) ){
$ext_valuelist = $ext_table->getValuelist( $ext_valuelist );
foreach ( $ext_valuelist as $ext_key=>$ext_value ){
$valuelists[$vlname][$ext_key] = $ext_value;
}
}
// clean up temp variables so they don't confuse us
// in the next iteration.

PostPosted: Wed Oct 18, 2006 7:40 am
by shannah
This is probably a problem with the valuelists.ini file. I would look into this closer. (Can you post your valuelists.ini file?).
Run the sql query directly inside MySQL to make sure it doesn't give errors.
Finally, upgrade to the latest version of dataface in case that fixes it -- though 0.6.2 should be fine.

-Steve

PostPosted: Mon Oct 23, 2006 2:51 am
by ferrante
Hi.
Yes, it was a problem with valuelists.ini. One of the vocabularies included a 0=0 pointing to a int field. I cannot fully understand why it caused the error, but now everything is OK.
Thank you!

PostPosted: Tue Oct 24, 2006 9:39 am
by alanslleung
There are certain keys that are not allowed in PHP INI files:
From http://php.net/parse_ini_file

Note: There are reserved words which must not be used as keys for ini files. These include: null, yes, no, true, and false. Values null, no and false results in "", yes and true results in "1". Characters {}|&~![()" must not be used anywhere in the key and have a special meaning in the value.


That would be what caused the problem.

Good to hear it's working now.

-Steve