Bug #85318
closedScheduler tasks: the constructor is never executed
0%
Description
When defining a scheduler task class by inheriting from \TYPO3\CMS\Scheduler\Task\AbstractTask
, an existing constructor does never get executed.
The execute
method is not static, but anyway it is called with the class being instantiated in a "normal" way, i.e. executing a constructor.
What to expect:
When I define a constructor in a class inherited from \TYPO3\CMS\Scheduler\Task\AbstractTask
it must be executed to allow for variable instantiation.
Example:
class ExampleTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask
{
public function __construct()
{
parent::__construct();
// This point is never reached, even a debug-breakpoint here would not be respected.
DebuggerUtility::var_dump($this);
exit;
}
}
Updated by Susanne Moog over 4 years ago
- Status changed from New to Rejected
The constructor is called when creating a new task object. However, after that first initial creation, the task is serialized in the database and reconstructed from that serialized object each time it runs. So to make sure that your variables are available after serialization/unserialization use sleep/wakeup callbacks.