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

date_format: check if already exists #902

Open
wants to merge 1 commit into
base: support/4.3
Choose a base branch
from

Conversation

kornrunner
Copy link

Since everything in libs/ gets autoloaded by composer - there's no easy way to override built-in modifiers.

This is an attempt at a workaround for date_format specifically, as seen within smarty_mb_str_replace

@rudiedirkx
Copy link

Since everything in libs/ gets autoloaded by composer

Is that true? I don't think that's true. My project has Smarty modifiers and functions overridden. Smarty loads those files on demand, not always by Composer. Just add a plugins_dir before Smarty's and that's where Smarty will look first.

	$smarty->plugins_dir = [
		PROJECT_INC_SMARTY . '/plugins', // Mine
		PROJECT_VENDOR . '/smarty/smarty/libs/plugins', // Smarty's built-in
	];

@kornrunner
Copy link
Author

Since everything in libs/ gets autoloaded by composer

Is that true? I don't think that's true. My project has Smarty modifiers and functions overridden. Smarty loads those files on demand, not always by Composer. Just add a plugins_dir before Smarty's and that's where Smarty will look first.

Specified within: https://github.com/smarty-php/smarty/blob/support/4.3/composer.json#L35-L38

	$smarty->plugins_dir = [
		PROJECT_INC_SMARTY . '/plugins', // Mine
		PROJECT_VENDOR . '/smarty/smarty/libs/plugins', // Smarty's built-in
	];

That's what I was using, but I get compile errors for using already declared function (because autoloader loaded the Smarty file, even before use).

@rudiedirkx
Copy link

Specified within: https://github.com/smarty-php/smarty/blob/support/4.3/composer.json#L35-L38

That's a class map, not functions. Functions aren't autoloaded. Maybe something else includes that file twice. Or a smarty/plugin cache. Or something. I've never had a problem with this. Buuut I have no idea which version I'm running. It would be very weird if this had changed on purpose.

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.

None yet

2 participants