CMS MADE SIMPLE FORGE

Form Builder

 

[#12189] Fatal error on Add New Field

avatar
Created By: Tristan (tristan)
Date Submitted: Thu Nov 14 05:51:59 -0500 2019

Assigned To: Fernando Morgado (JoMorg)
Version: 1.0.2
CMSMS Version: 2.2.12
Severity: Major
Resolution: Fixed
State: Open
Summary:
Fatal error on Add New Field
Detailed Description:
Getting a fatal error when trying to add a new field, either via the "Add New
Field" or with the Fast field adder.

Got error 'PHP message: PHP Fatal error:  Uncaught CmsError404Exception: Module
action not found in
/home/user/domains/domain.com/public_html/lib/classes/class.CMSModule.php:1395\nStack
trace:\n#0
/home/user/domains/domain.com/public_html/modules/FormBuilder/FormBuilder.module.php(193):
CMSModule->DoAction('admin_add_edit_...', 'm1_', Array, '')\n#1
/home/user/domains/domain.com/public_html/lib/classes/class.CMSModule.php(1479):
FormBuilder->DoAction('admin_add_edit_...', 'm1_', Array, '')\n#2
/home/user/domains/domain.com/public_html/admin/moduleinterface.php(74):
CMSModule->DoActionBase('admin_add_edit_...', 'm1_', Array, '',
Object(Smarty_CMS))\n#3 {main}\n  thrown in
/home/user/domains/domain.com/public_html/lib/classes/class.CMSModule.php on
line 1395\n', referer: https://domain.com/


History

Comments
avatar
Date: 2019-11-14 05:53
Posted By: Tristan (tristan)

Same error when trying to edit of course.
      
avatar
Date: 2019-11-14 09:37
Posted By: Tristan (tristan)

For some reason the action.admin_add_edit_field.php file isn't there after
install of the xml on some hosts, using the tar.gz will fix this problem.
      
avatar
Date: 2020-03-28 19:46
Posted By: Ruud van der Velden (ruudvdvelden)

This seems to be caused by Module Manager (core). 
lib\classes\class.moduleoperations.inc.php starting at line 402 (CASE 'FILE':)

Note there's an if( !file_exists( $moduledir ) ) 
if that's true (and for the first file in the downloaded xml that is true
because the folder /modules/FormBuilder is not yet created on NEW installs) it
will create the modules/FormBuilder folder but it will NOT create the file.

My suggestion is to remove 'else;  from line 421:


                        // ready to go
$moduledir=$dir.DIRECTORY_SEPARATOR.$moduledetails['name'];
                        $filename=$moduledir.$moduledetails['filename'];
                        if( !file_exists( $moduledir ) ) {
if( !@mkdir( $moduledir ) && !is_dir( $moduledir ) )
{
throw new
CmsFileSystemException(lang('errorcantcreatefile').': '.$moduledir);
                                break;
                            }
                        }
line 421 -->  if( $moduledetails['isdir'] ) {
if( !@mkdir( $filename ) && !is_dir( $filename ) ) {
throw new
CmsFileSystemException(lang('errorcantcreatefile').': '.$filename);
                                break;
                            }
                        }
                        else {
                            $data = $moduledetails['filedata'];
if( strlen( $data ) ) $data = base64_decode( $data
);
                            $fp = @fopen( $filename, "w" );
if( !$fp ) throw new
CmsFileSystemException(lang('errorcantcreatefile').' '.$filename);
                            if( strlen( $data ) ) @fwrite( $fp, $data );
                            @fclose( $fp );
                        }

Another workaround could be to add some bogus file/dir at the top of the FILE
list in the xml for FormBuilder. The file/dir itself will not be created but the
module/FormBuilder folder will.
      
avatar
Date: 2020-03-28 19:53
Posted By: Ruud van der Velden (ruudvdvelden)

I noted that other mofule's xml files have:

	<file>
	  <filename>/</filename>
	  <isdir>1</isdir>
	</file>

As the first module\file element. That will work too and will be less intrusive
than the core change.
      
avatar
Date: 2020-06-09 16:29
Posted By: Fernando Morgado (JoMorg)

The generated XML file had an issue not the module itself. XML file fixed and
uploaded. All should be good now. Thank you.
      
Updates

Updated: 2020-06-09 16:29
resolution_id: 5 => 7
assigned_to_id: 100 => 12532

Updated: 2019-11-14 05:53
resolution_id: => 5