Error from Table.php

A place for users and developers of the Xataface to discuss and receive support.

Postby ferrante » Fri Oct 13, 2006 2:54 am

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
ferrante
 
Posts: 12
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Oct 13, 2006 9:20 am

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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ferrante » Wed Oct 18, 2006 6:34 am

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.
ferrante
 
Posts: 12
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Wed Oct 18, 2006 7:40 am

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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ferrante » Mon Oct 23, 2006 2:51 am

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!
ferrante
 
Posts: 12
Joined: Wed Dec 31, 1969 5:00 pm

Postby alanslleung » Tue Oct 24, 2006 9:39 am

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
alanslleung
 
Posts: 3
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 27 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved