Browse Source

Merge pull request #5736 from jrbasso/3.0-list-php7

Fixed issue of list() using same variable for PHP-7
Mark Story 11 years ago
parent
commit
591bd64e11
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/I18n/Time.php

+ 4 - 2
src/I18n/Time.php

@@ -113,7 +113,8 @@ class Time extends Carbon implements JsonSerializable
     public function __construct($time = null, $tz = null)
     {
         if ($time instanceof \DateTime) {
-            list($time, $tz) = [$time->format('Y-m-d H:i:s'), $time->getTimeZone()];
+            $tz = $time->getTimeZone();
+            $time = $time->format('Y-m-d H:i:s');
         }
 
         if (is_numeric($time)) {
@@ -694,7 +695,8 @@ class Time extends Carbon implements JsonSerializable
         $timeFormat = $pattern = null;
 
         if (is_array($dateFormat)) {
-            list($dateFormat, $timeFormat) = $dateFormat;
+            list($newDateFormat, $timeFormat) = $dateFormat;
+            $dateFormat = $newDateFormat;
         } else {
             $pattern = $dateFormat;
             $dateFormat = null;