Location_err_save

Today is the day :frowning:
Since I come back to Agenda 1.2.1, a new error appears when saving a new Place : agenda.location_err_save

I have reinstalled Agenda 1.2.1, upgraded MODX and cleared cache but the error is still there :frowning:

On MODX lerror log, I have this :

[2022-02-24 13:46:31] (ERROR @ /home/LCL/web/domain.eu/core/cache/mgr/smarty/default/20268a5eea06a86658b4e8d3391aa18591ecfe62_0.file.header.tpl.php : 75) PHP warning: Undefined array key "a"
[2022-02-24 13:46:31] (ERROR @ /home/LCL/web/domain.eu/core/cache/mgr/smarty/default/20268a5eea06a86658b4e8d3391aa18591ecfe62_0.file.header.tpl.php : 80) PHP warning: Undefined array key "a"
[2022-02-24 13:46:32] (ERROR @ /home/LCL/web/domain.eu/core/xpdo/xpdo.class.php : 644) Could not load class: ArticlesContainer from mysql.articlescontainer.
[2022-02-24 13:46:33] (ERROR @ /home/LCL/web/domain.eu/core/model/phpthumb/phpthumb.class.php : 338) PHP warning: Undefined property: modPhpThumb::$cache_source_enabled
[2022-02-24 13:46:33] (ERROR @ /home/LCL/web/domain.eu/core/model/phpthumb/phpthumb.class.php : 338) PHP warning: Undefined property: modPhpThumb::$cache_source_directory
[2022-02-24 13:46:33] (ERROR @ /home/LCL/web/domain.eu/core/model/phpthumb/phpthumb.class.php : 338) PHP warning: Undefined property: modPhpThumb::$allow_local_http_src
[2022-02-24 13:46:33] (ERROR @ /home/LCL/web/domain.eu/core/model/phpthumb/phpthumb.class.php : 338) PHP warning: Undefined property: modPhpThumb::$cache_directory_depth
[2022-02-24 13:46:33] (ERROR @ /home/LCL/web/domain.eu/core/components/agenda/vendor/nesbot/carbon/src/Carbon/Translator.php : 193) PHP warning: include(/home/LCL/web/domain.eu/core/components/agenda/vendor/nesbot/carbon/src/Carbon/Lang/fr_FR.utf-8.php): Failed to open stream: Aucun fichier ou dossier de ce type
[2022-02-24 13:46:33] (ERROR @ /home/LCL/web/domain.eu/core/components/agenda/vendor/nesbot/carbon/src/Carbon/Translator.php : 193) PHP warning: include(): Failed opening '/home/LCL/web/domain.eu/core/components/agenda/vendor/nesbot/carbon/src/Carbon/Lang/fr_FR.utf-8.php' for inclusion (include_path='.:/usr/share/php')
[2022-02-24 13:46:33] (ERROR @ /home/LCL/web/domain.eu/core/model/phpthumb/phpthumb.class.php : 338) PHP warning: Undefined property: modPhpThumb::$cache_source_enabled
[2022-02-24 13:46:33] (ERROR @ /home/LCL/web/domain.eu/core/model/phpthumb/phpthumb.class.php : 338) PHP warning: Undefined property: modPhpThumb::$cache_source_directory
[2022-02-24 13:46:33] (ERROR @ /home/LCL/web/domain.eu/core/model/phpthumb/phpthumb.class.php : 338) PHP warning: Undefined property: modPhpThumb::$allow_local_http_src
[2022-02-24 13:46:33] (ERROR @ /home/LCL/web/domain.eu/core/model/phpthumb/phpthumb.class.php : 338) PHP warning: Undefined property: modPhpThumb::$cache_directory_depth
[2022-02-24 13:46:34] (ERROR @ /home/LCL/web/domain.eu/core/xpdo/xpdo.class.php : 644) Could not load class: ArticlesContainer from mysql.articlescontainer.
[2022-02-24 13:46:38] (ERROR @ /home/LCL/web/domain.eu/core/xpdo/om/xpdoobject.class.php : 1452) Error 22007 executing statement:
INSERT INTO `modx_agenda_locations` (`name`, `alias`, `address`, `description`, `resource_id`, `lat`, `lng`, `zoom`, `center_lat`, `center_lng`, `show`, `active`, `sortindex`, `createdon`, `createdby`, `editedon`, `editedby`) VALUES ('test', 'test', '', '', 0, '', '', 0, '', '', 1, 1, 42, 1645706798, 1, 0, 0)
Array
(
    [0] => 22007
    [1] => 1366
    [2] => Incorrect decimal value: '' for column `LCL_domain`.`modx_agenda_locations`.`lat` at row 1
)

I can give you access to the website by private message if you prefer

This will be fixed with the next release. There was no database model change during the upgrade/downgrade in that column.

But I will make sure that an empty string in in both columns is set to null.

The strange thing is Agenda worked well until I tried to upgrade (without success) to the 1.3.2 version…
I don’t understand why the backup don’t make it working well again…
It’s a blocking issue for my customer… :frowning:

I will create a release tomorrow.

Thank you :+1:

I can’t reproduce that here. Please take a look into core/components/agenda/processors/mgr/location/create.class.php

Does this file contains this code part?

public function beforeSave()
{
    $this->object->set('sortindex', strval($this->modx->getCount($this->classKey)));
    $this->object->set('createdby', $this->modx->getLoginUserID());
    $this->object->set('createdon', time());
    if ($this->object->get('alias') == '') {
        $this->object->set('alias', $this->uniqueAlias(modResource::filterPathSegment($this->modx, $this->getProperty('name'))));
    }
    if ($this->object->get('lat') == '') {
        $this->object->set('lat');
    }
    if ($this->object->get('lng') == '') {
        $this->object->set('lng');
    }
    if ($this->object->get('center_lat') == '') {
        $this->object->set('center_lat');
    }
    if ($this->object->get('center_lng') == '') {
        $this->object->set('center_lng');
    }

    return parent::beforeSave();
}

Which MODX version is running there?

Here my core/components/agenda/processors/mgr/location/create.class.php file :

<?php
/**
 * Create a Location
 *
 * @package agenda
 * @subpackage processors
 */

use TreehillStudio\Agenda\Processors\ObjectCreateProcessor;

/**
 * Class AgendaLocationCreateProcessor
 */
class AgendaLocationCreateProcessor extends ObjectCreateProcessor
{
    public $classKey = 'AgendaLocations';
    public $objectType = 'agenda.location';

    /** @var AgendaLocations $object */
    public $object;

    protected $required = ['name'];

    /**
     * {@inheritDoc}
     * @return bool
     */
    public function beforeSave()
    {
        $this->object->set('sortindex', strval($this->modx->getCount($this->classKey)));
        $this->object->set('createdby', $this->modx->getLoginUserID());
        $this->object->set('createdon', time());
        if ($this->object->get('alias') == '') {
            $this->object->set('alias', $this->uniqueAlias(modResource::filterPathSegment($this->modx, $this->getProperty('name'))));
        }
        if ($this->object->get('lat') == '') {
            $this->object->set('lat');
        }
        if ($this->object->get('lng') == '') {
            $this->object->set('lng');
        }
        if ($this->object->get('center_lat') == '') {
            $this->object->set('center_lat');
        }
        if ($this->object->get('center_lng') == '') {
            $this->object->set('center_lng');
        }

        return parent::beforeSave();
    }

    /**
     * Create an uinique alias
     *
     * @param $alias
     * @return string
     */
    private function uniqueAlias($alias)
    {
        $i = 0;
        while ($this->modx->getCount($this->classKey, array(
            'alias' => $alias . (($i) ? '-' . $i : '')
        ))) {
            $i += 1;
        }
        return $alias . (($i) ? '-' . $i : '');
    }
}

return 'AgendaLocationCreateProcessor';

I’m running MODX 2.8.3

When I’m saving the modification of a Place, on the MODx log I have this error :

[2022-02-27 21:38:45] (ERROR @ /home/LCL/web/lalalalala.eu/core/xpdo/xpdo.class.php : 644) Could not load class: ArticlesContainer from mysql.articlescontainer.
[2022-02-27 21:38:47] (ERROR @ /home/LCL/web/lalalalala.eu/core/xpdo/om/xpdoobject.class.php : 1452) Error 22007 executing statement:
UPDATE `modx_agenda_locations` SET `lat` = '',`lng` = '',`center_lat` = '',`center_lng` = '' WHERE `id` = 18
Array
(
    [0] => 22007
    [1] => 1366
    [2] => Incorrect decimal value: '' for column `LCL_lalalala`.`modx_agenda_locations`.`lat` at row 1
)



[2022-02-27 21:39:07] (ERROR @ /home/LCL/web/lalalalala.eu/core/xpdo/xpdo.class.php : 644) Could not load class: ArticlesContainer from mysql.articlescontainer.
[2022-02-27 21:39:11] (ERROR @ /home/LCL/web/lalalalala.eu/core/xpdo/om/xpdoobject.class.php : 1452) Error 22007 executing statement:
UPDATE `modx_agenda_locations` SET `lat` = '',`lng` = '',`center_lat` = '',`center_lng` = '' WHERE `id` = 18
Array
(
    [0] => 22007
    [1] => 1366
    [2] => Incorrect decimal value: '' for column `LCL_lalalala`.`modx_agenda_locations`.`lat` at row 1
)

It’s look like Agenda needs geolocalization (latitude, longitude…) but I don’t use this on this website…

This should be fixed with 1.3.4 available now.

1 Like

Thank you, it’s working now !