|
8 | 8 | namespace Nette\PhpGenerator; |
9 | 9 |
|
10 | 10 | use Nette; |
11 | | -use function addcslashes, array_keys, array_shift, count, dechex, implode, in_array, is_array, is_int, is_object, is_resource, is_string, ltrim, method_exists, ord, preg_match, preg_replace, preg_replace_callback, preg_split, range, serialize, str_contains, str_pad, str_repeat, str_replace, strlen, strrpos, strtoupper, substr, trim, unserialize, var_export; |
| 11 | +use function addcslashes, array_keys, array_shift, count, dechex, get_mangled_object_vars, implode, in_array, is_array, is_int, is_object, is_resource, is_string, ltrim, method_exists, ord, preg_match, preg_replace, preg_replace_callback, preg_split, range, serialize, str_contains, str_pad, str_repeat, str_replace, strlen, strrpos, strtoupper, substr, trim, unserialize, var_export; |
12 | 12 | use const PREG_SPLIT_DELIM_CAPTURE, STR_PAD_LEFT; |
13 | 13 |
|
14 | 14 |
|
@@ -149,15 +149,15 @@ private function dumpObject(object $var, array $parents, int $level, int $column |
149 | 149 | return $this->format( |
150 | 150 | "new \\$class(?, new \\DateTimeZone(?))", |
151 | 151 | $var->format('Y-m-d H:i:s.u'), |
152 | | - $var->getTimeZone()->getName(), |
| 152 | + $var->getTimezone()->getName(), |
153 | 153 | ); |
154 | 154 |
|
155 | 155 | } elseif ($var instanceof \UnitEnum) { |
156 | 156 | return '\\' . $var::class . '::' . $var->name; |
157 | 157 |
|
158 | 158 | } elseif ($var instanceof \Closure) { |
159 | 159 | $inner = Nette\Utils\Callback::unwrap($var); |
160 | | - if (Nette\Utils\Callback::isStatic($inner)) { |
| 160 | + if (is_callable($inner) && Nette\Utils\Callback::isStatic($inner)) { |
161 | 161 | return implode('::', (array) $inner) . '(...)'; |
162 | 162 | } |
163 | 163 |
|
@@ -276,7 +276,7 @@ private function dumpArguments(array $args, int $column, bool $named): string |
276 | 276 | */ |
277 | 277 | public static function createObject(string $class, array $props): object |
278 | 278 | { |
279 | | - if (method_exists($class, '__serialize')) { |
| 279 | + if (method_exists($class, '__unserialize')) { |
280 | 280 | $obj = (new \ReflectionClass($class))->newInstanceWithoutConstructor(); |
281 | 281 | $obj->__unserialize($props); |
282 | 282 | return $obj; |
|
0 commit comments