-
piieerre
Junior Member
-
Posts: 11
Threads: 4
Joined: Dec 2020
Reputation:
0
Hello everyone
I encounter an error after submitting a form (POST).
My CI version: 4.3.1
PHP version: 8.2.1
Here is the error:
TypeError
date(): Argument #2 ($timestamp) must be of type ?int, bool given
SYSTEMPATH/ThirdParty/Kint/Zval/Representation/SplFileInfoRepresentation.php at line 186
Code: 179 return null;
180 }
181
182 public function getMTime(): ?string
183 {
184 if (null !== $this->mtime) {
185
186 $year = \date('Y', $this->mtime);
187
188 if ($year !== \date('Y')) {
189 return \date('M d Y', $this->mtime);
190 }
191
192 return \date('M d H:i', $this->mtime);
193 }
- SYSTEMPATH/ThirdParty/Kint/Zval/Representation/SplFileInfoRepresentation.php : 186 — date()
- SYSTEMPATH/ThirdParty/Kint/Zval/Representation/SplFileInfoRepresentation.php : 151 — Kint\Zval\Representation\SplFileInfoRepresentation->getMTime ()
Code: 144 if ($this->perms & 0001) {
145 $this->flags[] = ($this->perms & 01000) ? 's' : 'x';
146 } else {
147 $this->flags[] = ($this->perms & 01000) ? 'S' : '-';
148 }
149
150 $this->contents = \implode($this->flags).' '.$this->owner.' '.$this->group;
151 $this->contents .= ' '.$this->getSize().' '.$this->getMTime().' ';
152
153 if ($this->is_link && $this->linktarget) {
154 $this->contents .= $this->path.' -> '.$this->linktarget;
155 } elseif (null !== $this->realpath && \strlen($this->realpath) < \strlen($this->path)) {
156 $this->contents .= $this->realpath;
157 } else {
158 $this->contents .= $this->path;
- SYSTEMPATH/ThirdParty/Kint/Parser/SplFileInfoPlugin.php : 53 — Kint\Zval\Representation\SplFileInfoRepresentation->__construct ()
Code: 46
47 public function parse(&$var, Value &$o, int $trigger): void
48 {
49 if (!$var instanceof SplFileInfo || $var instanceof SplFileObject) {
50 return;
51 }
52
53 $r = new SplFileInfoRepresentation(clone $var);
54 $o->addRepresentation($r, 0);
55 $o->size = $r->getSize();
56 }
57 }
58
- SYSTEMPATH/ThirdParty/Kint/Parser/Parser.php : 632 — Kint\Parser\SplFileInfoPlugin->parse ()
Code: 625
626 if (isset($this->plugins[$o->type][$trigger])) {
627 $plugins = $this->plugins[$o->type][$trigger];
628 }
629
630 foreach ($plugins as $plugin) {
631 try {
632 $plugin->parse($var, $o, $trigger);
633 } catch (Exception $e) {
634 \trigger_error(
635 'An exception ('.\get_class($e).') was thrown in '.$e->getFile().' on line '.$e->getLine().' while executing Kint Parser Plugin "'.\get_class($plugin).'". Error message: '.$e->getMessage(),
636 E_USER_WARNING
637 );
638 }
639
- SYSTEMPATH/ThirdParty/Kint/Parser/Parser.php : 427 — Kint\Parser\Parser->applyPlugins ()
Code: 420 }
421
422 $this->object_hashes[$hash] = $object;
423
424 if ($this->depth_limit && $o->depth >= $this->depth_limit) {
425 $object->hints[] = 'depth_limit';
426
427 $this->applyPlugins($var, $object, self::TRIGGER_DEPTH_LIMIT);
428 unset($this->object_hashes[$hash]);
429
430 return $object;
431 }
432
433 $reflector = new ReflectionObject($var);
434
- SYSTEMPATH/ThirdParty/Kint/Parser/Parser.php : 138 — Kint\Parser\Parser->parseObject ()
Code: 131 return $this->parseArray($var, $o);
132 case 'boolean':
133 case 'double':
134 case 'integer':
135 case 'null':
136 return $this->parseGeneric($var, $o);
137 case 'object':
138 return $this->parseObject($var, $o);
139 case 'resource':
140 return $this->parseResource($var, $o);
141 case 'string':
142 return $this->parseString($var, $o);
143 case 'unknown type':
144 case 'resource (closed)':
145 default:
- SYSTEMPATH/ThirdParty/Kint/Parser/Parser.php : 383 — Kint\Parser\Parser->parse ()
Code: 376 $stash = $val;
377 $copy[$i] = $refmarker;
378 if ($val === $refmarker) {
379 $child->reference = true;
380 $val = $stash;
381 }
382
383 $rep->contents[] = $this->parse($val, $child);
384 ++$i;
385 }
386
387 $this->applyPlugins($var, $array, self::TRIGGER_SUCCESS);
388 unset($var[$this->marker]);
389
390 return $array;
- SYSTEMPATH/ThirdParty/Kint/Parser/Parser.php : 131 — Kint\Parser\Parser->parseArray ()
Code: 124
125 if (!$this->applyPlugins($var, $o, self::TRIGGER_BEGIN)) {
126 return $o;
127 }
128
129 switch ($o->type) {
130 case 'array':
131 return $this->parseArray($var, $o);
132 case 'boolean':
133 case 'double':
134 case 'integer':
135 case 'null':
136 return $this->parseGeneric($var, $o);
137 case 'object':
138 return $this->parseObject($var, $o);
- SYSTEMPATH/ThirdParty/Kint/Parser/Parser.php : 565 — Kint\Parser\Parser->parse ()
Code: 558 $child->reference = true;
559 }
560 if ($val === $refmarker) {
561 $child->reference = true;
562 $val = $stash;
563 }
564
565 $rep->contents[] = $this->parse($val, $child);
566 ++$i;
567 }
568
569 $object->addRepresentation($rep);
570 $object->value = $rep;
571 $this->applyPlugins($var, $object, self::TRIGGER_SUCCESS);
572 unset($this->object_hashes[$hash]);
- SYSTEMPATH/ThirdParty/Kint/Parser/Parser.php : 138 — Kint\Parser\Parser->parseObject ()
Code: 131 return $this->parseArray($var, $o);
132 case 'boolean':
133 case 'double':
134 case 'integer':
135 case 'null':
136 return $this->parseGeneric($var, $o);
137 case 'object':
138 return $this->parseObject($var, $o);
139 case 'resource':
140 return $this->parseResource($var, $o);
141 case 'string':
142 return $this->parseString($var, $o);
143 case 'unknown type':
144 case 'resource (closed)':
145 default:
- SYSTEMPATH/ThirdParty/Kint/Parser/Parser.php : 565 — Kint\Parser\Parser->parse ()
Code: 558 $child->reference = true;
559 }
560 if ($val === $refmarker) {
561 $child->reference = true;
562 $val = $stash;
563 }
564
565 $rep->contents[] = $this->parse($val, $child);
566 ++$i;
567 }
568
569 $object->addRepresentation($rep);
570 $object->value = $rep;
571 $this->applyPlugins($var, $object, self::TRIGGER_SUCCESS);
572 unset($this->object_hashes[$hash]);
- SYSTEMPATH/ThirdParty/Kint/Parser/Parser.php : 138 — Kint\Parser\Parser->parseObject ()
Code: 131 return $this->parseArray($var, $o);
132 case 'boolean':
133 case 'double':
134 case 'integer':
135 case 'null':
136 return $this->parseGeneric($var, $o);
137 case 'object':
138 return $this->parseObject($var, $o);
139 case 'resource':
140 return $this->parseResource($var, $o);
141 case 'string':
142 return $this->parseString($var, $o);
143 case 'unknown type':
144 case 'resource (closed)':
145 default:
- SYSTEMPATH/ThirdParty/Kint/Parser/Parser.php : 565 — Kint\Parser\Parser->parse ()
Code: 558 $child->reference = true;
559 }
560 if ($val === $refmarker) {
561 $child->reference = true;
562 $val = $stash;
563 }
564
565 $rep->contents[] = $this->parse($val, $child);
566 ++$i;
567 }
568
569 $object->addRepresentation($rep);
570 $object->value = $rep;
571 $this->applyPlugins($var, $object, self::TRIGGER_SUCCESS);
572 unset($this->object_hashes[$hash]);
- SYSTEMPATH/ThirdParty/Kint/Parser/Parser.php : 138 — Kint\Parser\Parser->parseObject ()
Code: 131 return $this->parseArray($var, $o);
132 case 'boolean':
133 case 'double':
134 case 'integer':
135 case 'null':
136 return $this->parseGeneric($var, $o);
137 case 'object':
138 return $this->parseObject($var, $o);
139 case 'resource':
140 return $this->parseResource($var, $o);
141 case 'string':
142 return $this->parseString($var, $o);
143 case 'unknown type':
144 case 'resource (closed)':
145 default:
- SYSTEMPATH/ThirdParty/Kint/Parser/Parser.php : 383 — Kint\Parser\Parser->parse ()
Code: 376 $stash = $val;
377 $copy[$i] = $refmarker;
378 if ($val === $refmarker) {
379 $child->reference = true;
380 $val = $stash;
381 }
382
383 $rep->contents[] = $this->parse($val, $child);
384 ++$i;
385 }
386
387 $this->applyPlugins($var, $array, self::TRIGGER_SUCCESS);
388 unset($var[$this->marker]);
389
390 return $array;
- SYSTEMPATH/ThirdParty/Kint/Parser/Parser.php : 131 — Kint\Parser\Parser->parseArray ()
Code: 124
125 if (!$this->applyPlugins($var, $o, self::TRIGGER_BEGIN)) {
126 return $o;
127 }
128
129 switch ($o->type) {
130 case 'array':
131 return $this->parseArray($var, $o);
132 case 'boolean':
133 case 'double':
134 case 'integer':
135 case 'null':
136 return $this->parseGeneric($var, $o);
137 case 'object':
138 return $this->parseObject($var, $o);
- SYSTEMPATH/ThirdParty/Kint/Parser/Parser.php : 565 — Kint\Parser\Parser->parse ()
Code: 558 $child->reference = true;
559 }
560 if ($val === $refmarker) {
561 $child->reference = true;
562 $val = $stash;
563 }
564
565 $rep->contents[] = $this->parse($val, $child);
566 ++$i;
567 }
568
569 $object->addRepresentation($rep);
570 $object->value = $rep;
571 $this->applyPlugins($var, $object, self::TRIGGER_SUCCESS);
572 unset($this->object_hashes[$hash]);
- SYSTEMPATH/ThirdParty/Kint/Parser/Parser.php : 138 — Kint\Parser\Parser->parseObject ()
Code: 131 return $this->parseArray($var, $o);
132 case 'boolean':
133 case 'double':
134 case 'integer':
135 case 'null':
136 return $this->parseGeneric($var, $o);
137 case 'object':
138 return $this->parseObject($var, $o);
139 case 'resource':
140 return $this->parseResource($var, $o);
141 case 'string':
142 return $this->parseString($var, $o);
143 case 'unknown type':
144 case 'resource (closed)':
145 default:
- SYSTEMPATH/ThirdParty/Kint/Kint.php : 285 — Kint\Parser\Parser->parse ()
Code: 278 *
279 * @param mixed &$var Data to dump
280 * @param Value $base Base object
281 */
282 protected function dumpVar(&$var, Value $base): string
283 {
284 return $this->renderer->render(
285 $this->parser->parse($var, $base)
286 );
287 }
288
289 /**
290 * Gets all static settings at once.
291 *
292 * @return array Current static settings
- SYSTEMPATH/ThirdParty/Kint/Kint.php : 268 — Kint\Kint->dumpVar ()
Code: 261 $output .= $this->renderer->renderNothing();
262 }
263
264 foreach ($vars as $key => $arg) {
265 if (!$base[$key] instanceof Value) {
266 throw new InvalidArgumentException('Kint::dumpAll requires all elements of the second argument to be Value instances');
267 }
268 $output .= $this->dumpVar($arg, $base[$key]);
269 }
270
271 $output .= $this->renderer->postRender();
272
273 return $output;
274 }
275
- SYSTEMPATH/ThirdParty/Kint/Kint.php : 575 — Kint\Kint->dumpAll ()
Code: 568 }
569 }
570
571 $kintstance->setStatesFromStatics($statics);
572 $kintstance->setStatesFromCallInfo($call_info);
573
574 $bases = static::getBasesFromParamInfo($call_info['params'] ?? [], \count($args));
575 $output = $kintstance->dumpAll(\array_values($args), $bases);
576
577 if (static::$return || \in_array('@', $call_info['modifiers'], true)) {
578 return $output;
579 }
580
581 echo $output;
582
- SYSTEMPATH/Debug/Toolbar.php : 110 — Kint\Kint::dump ()
Code: 103 } else {
104 $oldKintMode = Kint::$mode_default;
105 $oldKintCalledFrom = Kint::$display_called_from;
106
107 Kint::$mode_default = Kint::MODE_RICH;
108 Kint::$display_called_from = false;
109
110 $kint = @Kint::dump($value);
111 $kint = substr($kint, strpos($kint, '</style>') + 8);
112
113 Kint::$mode_default = $oldKintMode;
114 Kint::$display_called_from = $oldKintCalledFrom;
115
116 $varData[esc($key)] = $kint;
117 }
- SYSTEMPATH/Debug/Toolbar.php : 370 — CodeIgniter\Debug\Toolbar->run ()
Code: 363 // Disable the toolbar for downloads
364 if ($response instanceof DownloadResponse) {
365 return;
366 }
367
368 $toolbar = Services::toolbar(config(self::class));
369 $stats = $app->getPerformanceStats();
370 $data = $toolbar->run(
371 $stats['startTime'],
372 $stats['totalTime'],
373 $request,
374 $response
375 );
376
377 helper('filesystem');
- SYSTEMPATH/Filters/DebugToolbar.php : 40 — CodeIgniter\Debug\Toolbar->prepare ()
Code: 33 * If the debug flag is set (CI_DEBUG) then collect performance
34 * and debug information and display it in a toolbar.
35 *
36 * @param array|null $arguments
37 */
38 public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
39 {
40 Services::toolbar()->prepare($request, $response);
41 }
42 }
43
- SYSTEMPATH/Filters/Filters.php : 196 — CodeIgniter\Filters\DebugToolbar->after ()
Code: 189 continue;
190 }
191
192 return $result;
193 }
194
195 if ($position === 'after') {
196 $result = $class->after($this->request, $this->response, $this->argumentsClass[$className] ?? null);
197
198 if ($result instanceof ResponseInterface) {
199 $this->response = $result;
200
201 continue;
202 }
203 }
- SYSTEMPATH/CodeIgniter.php : 519 — CodeIgniter\Filters\Filters->run ()
Code: 512 $filters->setResponse($this->response);
513
514 // After filter debug toolbar requires 'total_execution'.
515 $this->totalTime = $this->benchmark->getElapsedTime('total_execution');
516
517 // Run "after" filters
518 $this->benchmark->start('after_filters');
519 $response = $filters->run($uri, 'after');
520 $this->benchmark->stop('after_filters');
521
522 if ($response instanceof ResponseInterface) {
523 $this->response = $response;
524 }
525 }
526
- SYSTEMPATH/CodeIgniter.php : 368 — CodeIgniter\CodeIgniter->handleRequest ()
Code: 361 $this->response->send();
362 $this->callExit(EXIT_SUCCESS);
363
364 return;
365 }
366
367 try {
368 return $this->handleRequest($routes, $cacheConfig, $returnResponse);
369 } catch (RedirectException $e) {
370 $logger = Services::logger();
371 $logger->info('REDIRECTED ROUTE at ' . $e->getMessage());
372
373 // If the route is a 'redirect' route, it throws
374 // the exception with the $to as the message
375 $this->response->redirect(base_url($e->getMessage()), 'auto', $e->getCode());
- FCPATH/index.php : 67 — CodeIgniter\CodeIgniter->run ()
Code: 60 *---------------------------------------------------------------
61 * LAUNCH THE APPLICATION
62 *---------------------------------------------------------------
63 * Now that everything is setup, it's time to actually fire
64 * up the engines and make this app do its thang.
65 */
66
67 $app->run();
-
piieerre
Junior Member
-
Posts: 11
Threads: 4
Joined: Dec 2020
Reputation:
0
Yes I understand the error.
The problem is that it comes from a Codeigniter library and I don't see why...
-
piieerre
Junior Member
-
Posts: 11
Threads: 4
Joined: Dec 2020
Reputation:
0
Hello
Here is a sample code. The problem only appears when I submit the form
Code: public function edit($id_product)
{
helper('form');
$productModel = new \App\Models\ProductModel;
$product = $productModel->find((int)$id_product);
if(!$product):
return redirect()->to('/admin_kt/products');
endif;
if($this->request->getMethod() == 'post') {
$rules = [
'nom' => 'required',
'couv' => [
'rules' => 'is_image[couv]',
'label' => 'Image',
],
];
if($this->validate($rules)){
......
}
}
$data['product'] = $productModel->find((int)$id_product);
return view('/content/edit',$data);
}
While searching a bit, I realized that the problem came from the "is_image" validation rule.
Has anyone had this problem before? Is there a solution?
Thanks
-
Franck DVI
Newbie
-
Posts: 2
Threads: 0
Joined: Feb 2023
Reputation:
0
02-01-2023, 03:52 AM
(This post was last modified: 02-01-2023, 03:53 AM by Franck DVI.)
I have exactly the same problem with the same configuration.
My CI version: 4.3.1
PHP version: 8.2.1
I unlocked like this:
184 >> if (null !== $this->mtime && is_int ($this->mtime)) { // my patch
but I don't know if there are other consequences
And, yes, there is a upload in the post
-
piieerre
Junior Member
-
Posts: 11
Threads: 4
Joined: Dec 2020
Reputation:
0
Some news
I just ran some tests and here are my results:
- the problem appears when I submit a form with a form rule with "is_image" and there is no file uploaded (desired behavior, file upload is optional)
- when CI_ENVIRONMENT = development and the toolbal is activated. When I deactivate the toolbar in the configs "public bool $collectVarData = true;", the problem no longer appears!
-
Franck DVI
Newbie
-
Posts: 2
Threads: 0
Joined: Feb 2023
Reputation:
0
why my post has been deleted. ?
|