2

I recently bought freeform PRO(version 4.0.11) and upgraded my freeform(version 4.0.8) using the Solspace update method.

When I navigate to the module page and select the tab field types the page shows the following message.

No field types available.
What, you deleted all of the default ones, too? O_o

It also throws some PHP error's.

A PHP Error was encountered
Severity: Warning
Message: glob() [function.glob]: Pattern exceeds the maximum allowed length of 260 characters
Filename: libraries/Freeform_fields.php
Line Number: 300

A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: libraries/Freeform_fields.php
Line Number: 302

When I open the freeform_fields.php file from the libraries folder and navigate to line 300 I see the following piece of code.

    // -------------------------------------
    //  default fields
    // -------------------------------------

    $default_fields = glob(
        $this->default_path . 'freeform_ft.{' .
            implode(',', $this->data->defaults['default_fields']) . '}.php',
        GLOB_BRACE
    );

If I open the default_fields folder it shows a lot of freeform_ft_FIELDTYPENAME.php files.

Whats wrong and how can I fix it without removing/uninstalling the whole module and install it again? I want to keep my submissions.

  • If you go to Tools->Data->SQL manager and select manage tables, is there a table called exp_freeform_fieldtypes? If there is, is there any data in it? – Jim Wyse Apr 11 '13 at 12:55
  • Yes there is a table called exp_freeform_fieldtypes and the table is filled with data. – 0x1ad2 Apr 11 '13 at 13:14
  • If you want to email me a CP login and FT access I'd be happy to take a look under the hood. jim dot wyse at solspace.com – Jim Wyse Apr 11 '13 at 13:18
1

You can run this query to build the fieldtypes table. (as always, make sure you have backups before doing anything like this!)

Another thing to try is to delete your FreeForm folders in third_party and themes and upload them fresh. Often people try to just overwrite existing folders with the upgrade and strange things can happen. THis will not uninstall the module, so your data should be safe. It just makes sure the right files are in the right place.

DROP TABLE IF EXISTS `exp_freeform_fieldtypes`;
CREATE TABLE IF NOT EXISTS `exp_freeform_fieldtypes` (
  `fieldtype_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `fieldtype_name` varchar(250) DEFAULT NULL,
  `settings` text,
  `default_field` char(1) NOT NULL DEFAULT 'n',
  `version` varchar(12) DEFAULT NULL,
  PRIMARY KEY (`fieldtype_id`),
  KEY `fieldtype_name` (`fieldtype_name`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=15 ;

--
-- Dumping data for table `exp_freeform_fieldtypes`
--

INSERT INTO `exp_freeform_fieldtypes` (`fieldtype_id`, `fieldtype_name`, `settings`, `default_field`, `version`) VALUES
(1, 'checkbox', '[]', 'n', '4.0.0.b1'),
(2, 'checkbox_group', '[]', 'n', '4.0.0.b1'),
(3, 'country_select', '[]', 'n', '4.0.0.b1'),
(4, 'file_upload', '[]', 'n', '4.0.0.b1'),
(5, 'hidden', '[]', 'n', '4.0.0.b1'),
(6, 'mailinglist', '[]', 'n', '4.0.0.b1'),
(7, 'multiselect', '[]', 'n', '4.0.0.b1'),
(14, 'province_select', '[]', 'n', '4.0.10'),
(9, 'radio', '[]', 'n', '4.0.0.b1'),
(10, 'select', '[]', 'n', '4.0.0.b1'),
(11, 'state_select', '[]', 'n', '4.0.0.b1'),
(12, 'text', '[]', 'n', '4.0.0.b1'),
(13, 'textarea', '[]', 'n', '4.0.0.b1');
| improve this answer | |
  • I've tried your solution but it didn't work. I think the problem is the first PHP error. Windows only allows you to use a maximum of 260 characters in your file path. msdn.microsoft.com/en-us/library/… I thought maybe it possible to use the symlink() method of PHP to create a symbolic link for the var $this->default_path but that throws another PHP error. – 0x1ad2 Apr 11 '13 at 13:27
  • Gotta love IIS servers. Not sure what to tell you at this point. This is looking like a server issue, not an issue with FreeForm. Chances are you may run into this with other addons as well. I'll look around and see what I can find out. – Jim Wyse Apr 11 '13 at 14:00
  • I've limited my file path to less then 260 characters and the PHP error's dissapear but the problem related to default_fields is still there. – 0x1ad2 Apr 11 '13 at 14:01
  • Can I get a Super Admin login to the site? – Jim Wyse Apr 11 '13 at 14:12
  • I can't give you the credentials of the production environment. I've tried to reproduce the situation in the test-environment(unix) but that didn't work the field types will load succesfully. Also I get this problem in my development environment and you can't reach that. Maybe you could reproduce the situation I'm running WAMPP webserver on Windows 7 x64 – 0x1ad2 Apr 11 '13 at 14:21
0

@Jim Wyse

Could you find out why the following piece of code doesn't work on my Windows machine? It also outputs an empty array. The vars $this->default_path and $this->data->defaults['default_fields'] are filled with data. Maybe it could be related to the glob method.

File: Freeform_fields.php

Line: 296

    $default_fields = glob(
        $this->default_path . 'freeform_ft.{' .
            implode(',', $this->data->defaults['default_fields']) . '}.php',
        GLOB_BRACE
    );

I temporarly fixed it by creating the $default_fields array and pushed the file paths in there with the array_push method(not fully dnynamic like the code posted above).

    //Create an array
    $default_fields = array();

    //Foreach default field in default fields
    foreach($this->data->defaults['default_fields'] as $default_field)
    {
        //Push file path to default fields array
        array_push($default_fields, '../system/expressionengine/third_party/freeform/default_fields/freeform_ft.'.$default_field.'.php');
    }
| improve this answer | |
  • How deeply nested on the server is your install folder? I was going to suggest that we change the glob function to something else, but I am thinking that's not the issue and rather its too many folders deep with too long names. – user550 Apr 12 '13 at 9:04
  • Starting from my C: drive it's five folders deep then you will reach the related expressionengine project(root folder of the website). – 0x1ad2 Apr 12 '13 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.