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

Bug: Filters 'except' option not removing DebugToolbar comment for view #3002

Closed
aswinkumar863 opened this issue May 16, 2020 · 0 comments · Fixed by #3010
Closed

Bug: Filters 'except' option not removing DebugToolbar comment for view #3002

aswinkumar863 opened this issue May 16, 2020 · 0 comments · Fixed by #3010
Labels
bug Verified issues on the current code behavior or pull requests that will fix them in progress

Comments

@aswinkumar863
Copy link

Describe the bug
except option in filters disables the Debug Toolbar but adds the comment <!-- DEBUG-VIEW START -->. This comment breaks the css when I m trying to load the view as CSS with $this->response->setContentType('text/css'). May causes the problem for other content types also.

CodeIgniter 4 version
v4.0.3

Affected module(s)
CodeIgniter\View

Expected behavior, and steps to reproduce if appropriate

Expected that the comment should not be added when URI available in except filter.

Filters.php

public $globals = [
	'before' => [],
	'after'  => [
		'toolbar' => ['except' => 'style'],
		//'honeypot'
	],
];

if ($this->debug && (! isset($options['debug']) || $options['debug'] === true))
{
$toolbarCollectors = config(\Config\Toolbar::class)->collectors;
if (in_array(\CodeIgniter\Debug\Toolbar\Collectors\Views::class, $toolbarCollectors))
{
// Clean up our path names to make them a little cleaner
foreach (['APPPATH', 'SYSTEMPATH', 'ROOTPATH'] as $path)
{
if (strpos($this->renderVars['file'], constant($path)) === 0)
{
$this->renderVars['file'] = str_replace(constant($path), $path . '/', $this->renderVars['file']);
break;
}
}
$this->renderVars['file'] = ++$this->viewsCount . ' ' . $this->renderVars['file'];
$output = '<!-- DEBUG-VIEW START ' . $this->renderVars['file'] . ' -->' . PHP_EOL
. $output . PHP_EOL
. '<!-- DEBUG-VIEW ENDED ' . $this->renderVars['file'] . ' -->' . PHP_EOL;
}
}

Context

  • OS: Windows 7
  • Web server: Apache/2.4.41
  • PHP version: 7.3.9
@aswinkumar863 aswinkumar863 added the bug Verified issues on the current code behavior or pull requests that will fix them label May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants