You are here:  » filters Fatal error


filters Fatal error

Submitted by badger on Sat, 2006-07-01 19:05 in

Hi, i cant seem to get the filters working. Had a look on the forum and couldnt find anyone else with the same problem. Please help..

I clicked on filters > select text after in the filter type dropdown > then pick the products field > click add...

and i get the following:

Fatal error: Call to undefined function filter_Configure() in [path]\admin\feeds_filters_configure.php on line 114

Appreciate any help you could give me

Submitted by support on Sun, 2006-07-02 07:34

Hi,

The configure function that the script tries to call is constructed on line 112 as follows:

$configureFunction = "filter_".$filter["name"]."Configure";

So, with an error message of..

Call to undefined function filter_Configure()

..in implies that either the entire $filter record is empty, or just the filter name value $filter["name"].

To find out which, you would need to add the following code to admin/feeds_filters_configure.php on line 41:

  print_r($filter);exit();

This should display the $filter record so we can see what is wrong with it - if you could post the output from this modification that will help...

I don't really understand this error - the script shouldn't have redirected to the configure script if the filter name was empty (which could happen if incorrect modifications to includes/filter.php had been made, so it must have been setup in the database which probably means that the SQL in the configure script failed - but like you said it's not been reported before!

Can you also confirm if this happens with any feed and any filter type - as that will help cancel out any more possibilities.

Cheers,
David.

Submitted by badger on Tue, 2006-07-04 08:16

got it working, was a computer issue!!

Thanks

Submitted by keymaster on Mon, 2006-07-31 16:21

Encountering the exact same issue. Can't get filters working.

I did a bit of debugging, so maybe I can add some info to the problem.

It seems like the sql insert operation on the filters table in feeds_filters.php is failing, that's why the $filter["name"] in feeds_filters_configure.php is empty.

I confirmed this - the $result from the statement in database.php:

$result = mysql_query($sql,$link);

is false, and the $insert_id after that is 0.

The sql sent to MySQL looked fine, though:

INSERT INTO `filters` SET filename = 'merchant1.xml',field ='PRODNAME',name = 'nameCase',created = '1154360635'

I checked with phpMyAdmin and the filters table is empty, no records in it.

Thought it was a MySQL problem, but imports to the product table are working fine. Also, I was able to write the same INSERT sql to the filters table using phpMyAdmin.

It only fails when written from pricetapestry.

Not sure where to go from here.

Do you know how to find out why the query is failing?

I tried the ERR file in the MySQL data directory but it had no logs for today.

Am using MySQL 5.0 on Windows XP.

Any ideas?

Submitted by support on Mon, 2006-07-31 17:20

Hi,

Can you describe the visual appearance of the failure. Presumably, you click "Filters", select a field and filter type, then click Add. What happens after that?

The normal process is that the filter record is INSERT'ed, and then a 302 HTTP redirect to the configure page for the new filter.

Instead, what happens on your system?

Cheers,
David.

Submitted by keymaster on Mon, 2006-07-31 18:31

From the filters page, select the filter type and field, press "Add".

You are taken to a new page with the menu on top:

Site Home Admin Home | Category Mapping Featured Products Moderate Reviews

Manage Feed (merchant1.xml)

Configure Filter

You then see the heading of a two column table:

First column has no title, second column is "Field"

The first row of the table is empty.

Then there is following error message:

Fatal error: Call to undefined function: filter_configure() in c:\program files\apache group\apache\htdocs\testsite\admin\feeds_filters_configure.php on line 114

Submitted by support on Tue, 2006-08-01 11:22

Hi,

Is this problem still occuring?

Does it happen with all filter types?

Attn: Badger
If you're reading this, does it look like the same "Computer Issue" that you were having, and if so can you remember what was causing the problem?

Thanks,
David.

Submitted by keymaster on Tue, 2006-08-01 14:46

Unfortunately still occuring.

It happens with every filter type.

To rule out an environment issue, I deleted all tables, restarted the computer, re-ran setup, re-registered and re-imported everything. Problem still there.

Categories, featured products and Reviews also work, code has no problems inserting to those tables.

phpMyAdmin can insert to the filters table. Price tapestry can't.

weird...

Submitted by badger on Tue, 2006-08-01 15:11

sounds like the same issue i had alright. I went one step further with regard the environment and reinstalled my system. It was well overdue. I just couldnt be sure issues like this wearnt conflics on my ageing installation. Worked fine after.

Before, i installed WAMP5, played around quite a bit with it as i had never used PHP, apache or MySQL before. i changed everything, i also installed other versions and had an instalation of IIS for good mesure!

Submitted by keymaster on Tue, 2006-08-01 15:34

Perhaps this is the problem:

In setup.sql, when creating the filters table, the data field is defined without assigning a default value.

In feeds_filters.php, the INSERT statement assigns values to filename, field, name and created. But, no value is assigned to data. Since there is no default, the insert of the record fails.

In feeds_filters_configure.php, the filter records are read from the filters table and assigned into $filters. Since the record was not inserted, $filters[name] is null (as is every field), and therefore the $configurefunction's name is not created correctly.

This is why there is an undefined function error.

The correct fix would seem to be in setup.sql. Change the line in the filters table from:

data blob NOT NULL,

to:

data blob NOT NULL default '',

For those who don't feel like rerunning setup, like myself, at least for now, I added a '' (null) value for data in the sprintf in feeds_filters.php, so that it would assign something to data when writing.

I don't know why this didn't show up in testing. Perhaps your MySQL server is configured slightly differently than mine to not require default values on blob fields.

Anyways, will do some more testing, but looks like this was the problem.

My filters are working now.

The main thing I need to know now is: will the fix I have coded cause me any problems elsewhere in the code? (you obviously know the code much better than I)

Thanks for your help.

Submitted by support on Tue, 2006-08-01 16:20

badger - thanks for your help.

keymaster -
A default value of empty ('') for the data field will be fine, as this will be treated exactly as NULL as far as PHP is concerned. Thanks for identifiying the problem. The majority of installations (including both my dev and test servers) have no problem creating filters so this must be down to a MySQL version dependancy. My understanding is that if a default value is not specified then the type default value is used when an INSERT statement does not provide a value for a field. Type defaults are such values as 0 for numeric types, and an empty string for VARCHAR / TEXT etc.

I'll update the distribution to default the data field to ''.

Cheers,
David.