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

PHP 8 - Fix various datahandler event.php and calendar.php errors #4681

Open
wants to merge 5 commits into
base: feature
Choose a base branch
from

Conversation

RevertIT-alt
Copy link
Contributor

There could be more issues, but those are current ones that I manage to find and fix.

`trim()` allow the blank description to be added with newlines and whitespaces. Replaced with `trim_blank_chrs()` to fix it.
`trim()` allow the blank description to be added with whitespaces. Replaced with `trim_blank_chrs()` to fix it.
This will fix datahandler `event.php` when updating the calendar event. 
Line `580` and line 586` are throwing errors and line `591` is redundant because errors are already thrown before we come to set a default value. 
Reference: https://github.com/mybb/mybb/blob/44be739f817fcc4b04afcbb91fc6d91b59815bba/inc/datahandlers/event.php#L580-L591
This will prevent users from adding an invalid year and invalidate timezone.

The following example will throw an undefined error for the `timezone` array key...
```html
<select name="single_year">
<option value="invalid_text">2023</option>
</select>
```
}
else
{
$this->event_update_data['endtime'] = 0;
$this->event_update_data['usingtime'] = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it supposed to not be set anymore?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, L580 and L586 are throwing errors, and L591 is redundant because errors are already thrown before we come to set a default value.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like it may no longer be set/corrected when neither starttime nor endtime are set. It may be better to leave it to preserve the intended logic.

Copy link
Contributor

Choose a reason for hiding this comment

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

Submitted a correction, this now should cover all the instances of endtime/usingtime

@Eldenroot
Copy link
Contributor

@dvz is this finished?

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

4 participants