Forums

Blank screen+ after upgrade to Joomla 3.8

driv 20 Sep, 2017
Hello,
Last night I upgraded to Joomla 3.8 and I've just noticed that one of my forms is now displaying a blank white page.
I've cleared Chronoforms and Joomla cache but it's still the same.

Another two forms on the same site are displaying correctly but I get an error when they are submitted.

Mailer Error: Could not instantiate mail function.



I've used the Joomla test function and that works fine.

This is a test mail sent using "SMTP". Your email settings are correct!



Do you have any ideas what could be causing this?

Many thanks.






Chronoforms v5
Joomla 3.8
PHP 7.01
driv 20 Sep, 2017
I've enabled error reporting and get this...

Whoops \ Exception \ ErrorException (E_COMPILE_ERROR)
Cannot redeclare available() (previously declared in /var/sites/mysite.com/public_html/administrator/components/com_chronoforms5/chronoforms/actions/custom_code/custom_code.php(20) : eval()'d code:15)


So I've removed that custom code for now, but the mail issue still remains.
driv 20 Sep, 2017
I think my host has been mucking around with their mail server.

I've found the answer by filling in the SMTP settings in Chronoforms
(I tried searching on the mail instantiation error earlier but kept getting redirected to the forum home page.)

Anyhow, panic over, the forms now appear to be working. I'll open another thread about the custom code issue.

Thanks.
driv 20 Sep, 2017
Hi,
(I had planned to start a new thread but the title of this thread remains appropriate.)

I have a form that allows users to register for an event.

To stop the Select dropdown boxes from displaying booked places, I have some custom php to load an array with the available places.


<?php
$available_tables = available();
$free = array();
$free[] = array ('value' => '', 'text' => 'please select');

foreach ( $available_tables as $k => $v ) {
  $free[] = array( 'value' => $v, 'text' => $v );
} 
$form->data['req_table1'] = $free;
$form->data['req_table2'] = $free;
$form->data['req_table3'] = $free;


function available() {
-
-
-
Basic PHP returning available places
-
-
-

$result = array_diff($available, $bookedSpaces);
return $result;
} 
?>


Since updating Joomla to 3.8, I am getting a blank page.

Error reporting shows...

Whoops \ Exception \ ErrorException (E_COMPILE_ERROR)
Cannot redeclare available() (previously declared in /var/sites/mysite.com/public_html/administrator/components/com_chronoforms5/chronoforms/actions/custom_code/custom_code.php(20) : eval()'d code:15)



Any ideas what I could do to stop this error?

Thank you.
GreyHead 21 Sep, 2017
HI driv,

I suggest that you try renaming the function in your Custom Code - I guess that Joomla has added a available() function in the new release. Something like available_cf() is unlikely to be duplicated.

Bob
driv 21 Sep, 2017
Hi Bob,
Thanks for that suggestion. I tried it, but unfortunately, the problem remains.

[21-Sep-2017 11:48:08 UTC] PHP Fatal error: Cannot redeclare CFavailable() (previously declared in /var/sites/mysite.com/public_html/administrator/components/com_chronoforms5/chronoforms/actions/custom_code/custom_code.php(20) : eval()'d code:15) in /var/sites/mysite.com/public_html/administrator/components/com_chronoforms5/chronoforms/actions/custom_code/custom_code.php(20) : eval()'d code on line 43



The error page also shows the code where this is happening...
 Open:
/var
/sites
/mysite.com
/public_html
/administrator
/components
/com_chronoforms5
/chronoforms
/actions
/custom_code
/custom_code.php

    <?php
    /**
    * ChronoCMS version 1.0
    * Copyright (c) 2012 ChronoCMS.com, All rights reserved.
    * Author: (ChronoCMS.com Team)
    * license: Please read LICENSE.txt
    * Visit http://www.ChronoCMS.com for regular updates and information.
    **/
    namespace GCore\Admin\Extensions\Chronoforms\Actions\CustomCode;
    /* @copyright:ChronoEngine.com @license:GPLv2 */defined('_JEXEC') or die('Restricted access');
    defined("GCORE_SITE") or die;
    Class CustomCode extends \GCore\Admin\Extensions\Chronoforms\Action{
        static $title = 'Custom Code';
     
        function execute(&$form, $action_id){
            $config =  $form->actions_config[$action_id];
            $config = new \GCore\Libs\Parameter($config);
            $content = $config->get('content', '');
            ob_start();
            eval('?>'.$content);
            $output = ob_get_clean();
            echo \GCore\Libs\Str::replacer($output, $form->data, array('repeater' => 'repeater'));
        }
     
        public static function config($configs = array(), $extra_config = array()){
            echo \GCore\Helpers\Html::formStart('action_config custom_code_action_config', 'custom_code_action_config__XNX_');
            echo \GCore\Helpers\Html::formSecStart();
            echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][action_label]', array('type' => 'text', 'label' => l_('CF_ACTION_LABEL'), 'class' => 'XL', 'sublabel' => l_('CF_ACTION_LABEL_DESC')));
            echo \GCore\Helpers\Html::formLine('Form[extras][actions_config][_XNX_][content]', array('type' => 'textarea', 'label' => l_('CF_CONTENT'), 'rows' => 15, 'cols' => 70, 'sublabel' => l_('CF_CONTENT_CUSTOM_CODE_DESC')));
            echo \GCore\Helpers\Html::formSecEnd();


This line is highlighted...

eval('?>'.$content);



I'm guessing that something doesn't like a function being assigned to a variable...?

Any further thoughts?
Thanks.
driv 21 Sep, 2017
Answer
I found a workaround...
I created a file outside of Joomla, placed the function in there and 'included' it into custom php.
This topic is locked and no more replies can be posted.