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

reduce str_replace in View/Parser::render() #1159

Merged

Conversation

samsonasik
Copy link
Member

No description provided.


// Was it cached?
if (isset($options['cache']))
{
$cacheName = $options['cache_name'] ?: str_replace('.php', '', $view);
$cacheName = $options['cache_name'] ?: $template;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should be the $view variable, shouldn't it? Otherwise you're missing the .php extension. At which point, you could have left the previous couple of lines just like they were unless there's a specific use for template and view later?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, it is the variable that assigned to $cacheName, so without ".php", previously, we double call str_replace to $view to remove ".php".

$view with ".php" still used in next flow on append to viewPath.

@samsonasik samsonasik force-pushed the reduce-str-replace-parser branch from bed26b2 to b1c5aea Compare August 13, 2018 15:13
@samsonasik
Copy link
Member Author

@lonnieezell I've updated the code to not introduce new variable, so, it uses existing $view variable without .php for cacheName

@lonnieezell lonnieezell merged commit 5c0ce8a into codeigniter4:develop Aug 13, 2018
@samsonasik samsonasik deleted the reduce-str-replace-parser branch August 13, 2018 18:38
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 this pull request may close these issues.

2 participants