Project

General

Profile

Actions

Bug #85318

closed

Scheduler tasks: the constructor is never executed

Added by Feeela no-lastname-given almost 6 years ago. Updated about 4 years ago.

Status:
Rejected
Priority:
Must have
Assignee:
-
Category:
scheduler
Target version:
-
Start date:
2018-06-20
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
Is Regression:
Sprint Focus:

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;
    }
}

Actions #1

Updated by Feeela no-lastname-given almost 6 years ago

  • Description updated (diff)
Actions #2

Updated by Susanne Moog about 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.

Actions

Also available in: Atom PDF