Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toolbar::setFiles() requires int [strict_types=1] #4408

Closed
John-Betong opened this issue Mar 11, 2021 · 1 comment · Fixed by #4548
Closed

Toolbar::setFiles() requires int [strict_types=1] #4408

John-Betong opened this issue Mar 11, 2021 · 1 comment · Fixed by #4548

Comments

@John-Betong
Copy link

Info
I have been trying for over a week to trace a new site's "Network connection Error" from going down overnight. No errors in logs so added "strict_types=1" to all PHP app and system PHP files, also set .env -> CI_ENVIRONMENT = development and eventually managed to get some errors reported.

Describe the bug
Incorrect type being passed to

CodeIgniter 4 version
CI_VERSION - 4.1.1

Affected module(s)
file: ./system/Debug/Toolbar.php
[code]
protected function format(string $data, string $format = 'html'): string
{
$data = json_decode($data, true);

	if ($this->config->maxHistory !== 0)
	{
		$history = new History();
		# PROBLEM - 2021-03-06 - FORCE (int)
		# CRITICAL - 2021-03-07 04:29:00 --> Argument 1 passed to 
		# CodeIgniter\Debug\Toolbar\Collectors\History::setFiles() 
		# must be of the type int, string given, 
		# called in /var/www/ci4-strict.tk/system/Debug/Toolbar.php on line 442
		$history->setFiles(
				(int) Services::request()->getGet('debugbar_time'),
				$this->config->maxHistory
		); 

		$data['collectors'][] = $history->getAsArray();
	}

[/code]

Expected behavior, and steps to reproduce if appropriate
did not expect web page to crash

Context

  • OS: [Ubuntu 20.04.1]
  • Web server [Apache 2]
  • PHP version [8.0.3]
@John-Betong John-Betong added the bug Verified issues on the current code behavior or pull requests that will fix them label Mar 11, 2021
@MGatner
Copy link
Member

MGatner commented Mar 11, 2021

This is a problem with using strict types, something the framework does not guarantee. If you would like to submit a PR I will review it but I don't consider this one a "bug".

@MGatner MGatner changed the title Bug: Bug: Toolbar::setFiles() requires int Mar 11, 2021
@paulbalandan paulbalandan removed the bug Verified issues on the current code behavior or pull requests that will fix them label Mar 12, 2021
@paulbalandan paulbalandan changed the title Bug: Toolbar::setFiles() requires int Toolbar::setFiles() requires int [strict_types=1] Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants