Hi,

Since PHP version 5.0, clone is a reserved keyword and cannot be invoked as a function.

Found this issue during an incompatibility scan to PHP 5.6

http://php.net/manual/en/reserved.keywords.php
https://github.com/wimg/PHPCompatibility

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jribeiro’s picture

Status: Active » Needs review
FileSize
8.27 KB
badjava’s picture

Status: Needs review » Reviewed & tested by the community

Confirmed this fixes the issue and is the proper usage of clone as per:

http://php.net/manual/en/language.oop5.cloning.php

podarok’s picture

Status: Reviewed & tested by the community » Needs review

Let's get testing bot for 5.6 then
https://www.drupal.org/pift-ci-job/132748

DamienMcKenna’s picture

rajeev_drupal’s picture

Assigned: Unassigned » rajeev_drupal
rajeev_drupal’s picture

Status: Needs review » Reviewed & tested by the community

Tested the patch manually and it's working fine.
Also it's pass in automated custom test: https://www.drupal.org/pift-ci-job/642296

As Clone is reserved keyword it's good to not use it as function.
http://php.net/manual/en/reserved.keywords.php

rajeev_drupal’s picture

Tested the patch manually and it's working fine.
Also it's pass in automated custom test: https://www.drupal.org/pift-ci-job/642296

As Clone is reserved keyword it's good to not use it as function.
http://php.net/manual/en/reserved.keywords.php

DamienMcKenna’s picture

rajeev_drupal’s picture

Assigned: rajeev_drupal » Unassigned

DamienMcKenna’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

AritoMelo’s picture

The patches work for version 2.10, however, for the oldest version like 2.9, it needs to do a little change, instead of using $argument->min_date use $argument->max_date as shown below.

@@ -279,9 +279,9 @@ function query() {
          ...
         else {
-          $this->view->date_info->prev_date = clone($argument->min_date);
+          $this->view->date_info->prev_date = clone $argument->min_date;
           date_modify($this->view->date_info->prev_date, '-1 ' . $argument->date_handler->granularity);
-          $this->view->date_info->next_date = clone($argument->max_date);
+          $this->view->date_info->next_date = clone $argument->max_date;
           date_modify($this->view->date_info->next_date, '+1 ' . $argument->date_handler->granularity);
         }
DamienMcKenna’s picture

@aritomelo: Hopefully you won't have to keep using 2.9 and we'll be able to fix any bugs that are preventing you from updating :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.