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

Update to smarty 5 #865

Merged
merged 15 commits into from
Jan 31, 2025
Merged

Update to smarty 5 #865

merged 15 commits into from
Jan 31, 2025

Conversation

onli
Copy link
Member

@onli onli commented Jan 19, 2025

Composer update to smarty 5 + necessary fixes to get the smarty classes working again.

Tested superficially in my test blog only so far. https://smarty-php.github.io/smarty/5.x/upgrading/#backwards-incompatible-changes-to-custom-plugins lists a lot of removals, I'd be surprised if this was everything to do.

@onli onli requested a review from garvinhicking January 19, 2025 20:37
@onli onli mentioned this pull request Jan 19, 2025
@garvinhicking
Copy link
Member

Wow!!! You're on a roll. Smarty5 and the outlook on changes was what killed me.

If this is working this would be insanely great and a HUGE step towards keeping s9y alive.

I love you! 🥹

Also removes unused code from the smarty security wrapper
@garvinhicking
Copy link
Member

As for testing:

  • we should clear templates_c to ensure no compuled templates from old smarty are around
  • do custom registered smarty functions still work?
  • check all our setendipity_smarty stubs if they are still callable/executable
  • see if code modifying references (instead copied variables) is around and how to deal with that? I think there were some things were smarty modified variables and later PHP code must access those modified variables

But one step at a time :)

@onli
Copy link
Member Author

onli commented Jan 19, 2025

Love you too ;)

You caused me a bad conscience though, the testing was very preliminary. Only the later commit fixed entry creation, after your comment.

we should clear templates_c to ensure no compuled templates from old smarty are around

It gets repopulated properly :)

do custom registered smarty functions still work?

Yes, the system works. In fact it's necessary to add the php functions to that system that were provided by Serendipity_Smarty_Security_Policy before. I did that in 732f671. Sadly the code in the documentation that shows the registration without a custom function did not work for me (complained about i.e. isset not being callable).

check all our setendipity_smarty stubs if they are still callable/executable

This could maybe need some unittests... In general those seem to work though, otherwise the dev blog would not render.

see if code modifying references (instead copied variables) is around and how to deal with that? I think there were some things were smarty modified variables and later PHP code must access those modified variables

Right, that was removed:

You cannot use plugins that expect a parameter by reference anymore. PHP-function such as reset(), prev(), next() and end() can be registered as plugin, but they won't work because they expect a parameter by reference and Smarty will try to pass it by value.

I did not notice usage of that, ofc I might have just missed it.

@onli
Copy link
Member Author

onli commented Jan 31, 2025

@garvinhicking I added some test cases now. They don't cover all those functions, but they do test that a few custom modifiers work, as well as one PHP function and modifier that were broken after the smarty 5 upgrade initially. Let's merge this?

@garvinhicking
Copy link
Member

IMO this is the only way forward. We need to adopt here or get left behind too much. I trust in your work so far, couldn't check/test it out myself though. Generally this looks like a good approach, so.... fingers crossed? Leeeeroyyyyyyyyyyy

@onli onli merged commit 7c28042 into master Jan 31, 2025
4 checks passed
@onli onli deleted the feature/smarty5 branch January 31, 2025 22:31
@onli
Copy link
Member Author

onli commented Jan 31, 2025

Worst case we revert and try again :) I merged it

@onli onli mentioned this pull request Feb 1, 2025
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