-
Notifications
You must be signed in to change notification settings - Fork 88
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
"Illegal string offset" PHP warnings #642
Comments
Forgot: Tested with current release version (2.3.1). |
Serendipity is currently not compatible with PHP E_NOTICE turned on. Usually production versions of s9y should turn off E_NOTICE, and only alpha/testing versions should have it on. I think there are circumstances, where a PHP error_reporting is not touched, if it is specifically set on an instance. Having said that, it would be much appreciated if Serendipity could take care of all uninitialized variables. However because it stemming from times where dynamic typing was still a valid and easy thing to do, it is much work to initialize each and every variable before use or check for its existance, which will also blow up the amount of code. |
These aren't E_NOTICE warnings. Test:
|
Very true. Thanks for pointing out my mistake. I just pushed a commit that should catch this type misbehaviour . The patch should also apply to older s9y releases, would you be able to confirm this fixes the warnings? |
…ndipity']. refs s9y#642 Backported from master branch. Signed-off-by: Thomas Hochstein <thh@inter.net>
This fixes the warnings, but it introduces more PHP notices due to accessing an undefined index. This can easily be fixed with an array_key_exists check, I'll do a pull request. |
See s9y#642. Backported from master branch. Signed-off-by: Thomas Hochstein <thh@inter.net>
@hannob I saw a major problem; in the code we actually assign I hope the new commit properly addresses both your concern and allows proper function, could you test that on your site if it still prevents undefined index notices? |
(See #653 for reference) |
oh yeah, sorry for my insufficient testing. I can confirm the bug, I applied the patch and will look if new warnings appear in the logs. |
I think we're done here. |
Accessing certain URLs gives me plenty of "Illegal string offset" warnings in the PHP log.
I reproduced this on a fresh installation, so I'm reasonably confident it's nothing with special extensions or special config options. This happens in all PHP versions from 7.1 to 7.4 (i.e. all currently supported ones), I haven't tested older ones.
The errors get triggered when an URL of this form is accessed:
The warnings in the log look like this:
The text was updated successfully, but these errors were encountered: