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

safe_file_write() doesn't like null for its $backup_file argument #7834

Closed
Sesquipedalian opened this issue Aug 31, 2023 · 0 comments · Fixed by #7835
Closed

safe_file_write() doesn't like null for its $backup_file argument #7834

Sesquipedalian opened this issue Aug 31, 2023 · 0 comments · Fixed by #7835
Milestone

Comments

@Sesquipedalian
Copy link
Member

Description

I don't recall seeing this in earlier PHP versions, but at least in PHP 8.2, if the $backup_file argument for safe_file_write() is null, errors will be generated on line 1874 about file_exists() not liking null arguments, and then on line 1929 about $temp_bfile not being defined.

Steps to reproduce

  1. Write some code that calls safe_file_write($file, $data) (note the lack of a $backup_file argument).
  2. Run that code.

Environment (complete as necessary)

  • Version/Git revision: 2.1.4
  • Database Type: N/A
  • Database Version: N/A
  • PHP Version: 8.2.5

Additional information/references

SMF itself doesn't encounter this bug because we always call safe_file_write() with the $backup_file argument set to a file path. But I ran into it while testing updates to a mod that calls the function without a $backup_file argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant