Skip Navigation

Resolved

Reported for: WPML Multilingual CMS 4.5.12

Resolved in: 4.6.0

Topic Tags: ATE, Bug

Overview of the issue

The following PHP error appears when you try to update a translation or add a new translation job to the basket by going to WPMLTranslation Management:

Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string in …/wp-content/plugins/sitepress-multilingual-cms/classes/jobs/class-wpml-tm-jobs-repository.php on line 155

Workaround

Please be sure of having a full backup of your website before proceeding.

  1. Open the wp-content/plugins/sitepress-multilingual-cms/classes/jobs/query/StringQuery.php file.
  2. Look for line 49.
  3. Replace:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    public function get_data_query( WPML_TM_Jobs_Search_Params $params ) {
        $columns = array(
            'string_translations.id as id',
            '"' . WPML_TM_Job_Entity::STRING_TYPE . '" as type',
            'string_status.rid as tp_id',
            'batches.id as local_batch_id',
            'batches.tp_id as tp_batch_id',
            $this->batch_name_column,
            'string_translations.status as status',
            'strings.id as original_element_id',
            'strings.language as source_language',
            'string_translations.language as target_language',
            'string_translations.translation_service as translation_service',
            'string_status.timestamp as sent_date',
            'NULL as deadline_date',
            'NULL as completed_date',
            'strings.value as title',
            'source_languages.english_name as source_language_name',
            'target_languages.english_name as target_language_name',
            'string_translations.translator_id as translator_id',
            'NULL as translate_job_id',
            'core_status.tp_revision AS revision',
            'core_status.ts_status AS ts_status',
            'NULL AS needs_update',
            'NULL AS editor',
            'string_translations.status = ' . ICL_TM_COMPLETE . '  AS has_completed_translation',
            'NULL AS editor_job_id',
            '0 AS automatic',
            'NULL AS review_status',
            'NULL AS trid',
            'NULL AS element_type',
            'NULL AS job_title',
        );
     
        return $this->build_query( $params, $columns );
    }

    With:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
        public function get_data_query( WPML_TM_Jobs_Search_Params $params ) {
        $columns = array(
            'string_translations.id as id',
            '"' . WPML_TM_Job_Entity::STRING_TYPE . '" as type',
            'string_status.rid as tp_id',
            'batches.id as local_batch_id',
            'batches.tp_id as tp_batch_id',
            $this->batch_name_column,
            'string_translations.status as status',
            'strings.id as original_element_id',
            'strings.language as source_language',
            'string_translations.language as target_language',
            'NULL AS trid',
            'NULL AS element_type',
            'string_translations.translation_service as translation_service',
            'string_status.timestamp as sent_date',
            'NULL as deadline_date',
            'NULL as completed_date',
            'strings.value as title',
            'source_languages.english_name as source_language_name',
            'target_languages.english_name as target_language_name',
            'string_translations.translator_id as translator_id',
            'NULL as translate_job_id',
            'core_status.tp_revision AS revision',
            'core_status.ts_status AS ts_status',
            'NULL AS needs_update',
            'NULL AS editor',
            'string_translations.status = ' . ICL_TM_COMPLETE . '  AS has_completed_translation',
            'NULL AS editor_job_id',
            '0 AS automatic',
            'NULL AS job_title',
            'NULL AS review_status',
            'NULL AS element_id',
        );
     
        return $this->build_query( $params, $columns );
    }

2 Responses to “Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string”

    • Hey there,
      Until we don’t release a WPML version including this patch, I’m afraid of that. However, this is already reported and it is on our developers road map.
      We’ll keep this errata updated.
      Cheers