Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-27373

Error when edit empty not required date

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.7.4-rc, 1.10.0
    • Component/s: Search
    • Labels:
      None
    • Environment:

      LAMP

      Description

      Hello,

      Version : 6.9@dev

      Since a last composer update, when I update a node with an empty row date I have this error :

      <?xml version="1.0" encoding="UTF-8"?>
      <ErrorMessage media-type="application/vnd.ez.api.ErrorMessage+xml">
      <errorCode>500</errorCode>
      <errorMessage>Internal Server Error</errorMessage>
      <errorDescription>
      DateTime::__construct(): Failed to parse time string (@) at position 0 (@): Unexpected character
      </errorDescription></ErrorMessage

      I have this in the logs :

      request.CRITICAL: Uncaught PHP Exception Exception:
      "DateTime::__construct(): Failed to parse time string (@) at position 0 (@): Unexpected character"
      at
      /var/www/ezplatform/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/Date/SearchField.php line 32

      {"exception":"[object] (Exception(code: 0): DateTime::__construct(): Failed to parse time string (@) at position 0 (@): Unexpected character at /var/www/ezplatform/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/Date/SearchField.php:32)"}

      []

      I have patch the vendor like this for correct the problem :

      public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
      {
      //@patch add this if
      if($field->value->data['timestamp']!=""){
      $dateTime = new DateTime("@{$field->value->data['timestamp']}");

      return array(
      new Search\Field(
      'value',
      $dateTime->format('Y-m-d
      Z'),
      new Search\FieldType\DateField()
      ),
      );
      }
      }

      Best regards,
      Alexandre

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              Alex57 Alexandre Leblanc
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: