Jump to content

Recommended Posts

Posted

I'm currently tasked with developing a domain registrar module, and I've found a few important points. Although the functional flow of both the registrar module and Blesta core is still running, I'm not satisfied as long as there is an error message:

Problem Analysis:

Attempting plugin cron for domains domain_synchronization.
Attempt to read property "start_date" on bool
#0 /vendors/monolog/monolog/src/Monolog/ErrorHandler.php(232): UnknownException::setErrorHandler(2, 'Attempt to read...', '/...', 1431, Array)
#1 /plugins/domains/domains_plugin.php(1431): Monolog\ErrorHandler->handleError(2, 'Attempt to read...', '/...', 1431)
#2 /plugins/domains/domains_plugin.php(1392): DomainsPlugin->synchronizeDomains()
#3 /core/Automation/Tasks/Task/Plugin.php(74): DomainsPlugin->cron('domain_synchron...')
#4 /core/Automation/Tasks/Task/Plugin.php(49): Blesta\Core\Automation\Tasks\Task\Plugin->process(Object(stdClass))
#5 /app/controllers/cron.php(702): Blesta\Core\Automation\Tasks\Task\Plugin->run()
#6 /app/controllers/cron.php(203): Cron->pluginTasks(1764759341.7541)
#7 /app/controllers/cron.php(151): Cron->all(1764759341.7541)
#8 /vendors/minphp/bridge/src/Lib/Dispatcher.php(142): Cron->index()
#9 /index.php(21): Dispatcher::dispatch('/cron/?cron_key...')
#10 {main}

The error occurs on line 1431 in the file domains_plugin.php:

Attempt to read property "start_date" on bool

This means the database query returned false (boolean) instead of an object, and then the core function attempted to access the property ->start_date from that boolean.

Potential Issue

The potential problem I found on line 1431 is within this code snippet:

if ($this->Date->cast($last_run->start_date ?: date('c'), 'Y-m-d') !== ...

The preceding query (lines 1415-1423) returns false if there is no record (i.e., the cron has never run). However, the code directly accesses $last_run->start_date without performing a null or existence check first.

I apologize if my analysis is incorrect; please provide an explanation and correction. I am not sure if this is a core domain plugin bug or an issue with the registrar module I built, but I see my plugin in full log mode for every action, yet there is nothing that potentially indicates an error. Although the flow works normally, I want all processes to be clean. Could fellow developers here please shed some light on this?

I temporarily fixed this by modifying the Blesta core file in the domains_plugin.php because the boss did not want to see any error logs, but editing the Blesta core is not a proper solution.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...