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

Check for existence and readability of static leases file before trying to access it #1206

Merged
merged 1 commit into from Apr 21, 2020

Conversation

DL6ER
Copy link
Member

@DL6ER DL6ER commented Apr 7, 2020

By submitting this pull request, I confirm the following:

  • I have read and understood the contributors guide, as well as this entire template.
  • I have made only one major change in my proposed changes.
  • I have commented my proposed changes within the code.
  • I have tested my proposed changes, and have included unit tests where possible.
  • I am willing to help maintain this change if there are issues with it later.
  • I give this submission freely and claim no ownership.
  • It is compatible with the EUPL 1.2 license
  • I have squashed any insignificant commits. (git rebase)

What does this PR aim to accomplish?:

Fix wrong error message as mentioned on Discourse (see link below).

How does this PR accomplish the above?:

PHP's suppression of fopen errors does not reliable so we check ourselves for existence + readability of the requested file before trying to open it.

What documentation changes (if any) are needed to support this PR?:

None

…ng to access it.

Signed-off-by: DL6ER <dl6er@dl6er.de>
@DL6ER DL6ER added the Bugfix label Apr 7, 2020
@DL6ER DL6ER added this to the v5.0 milestone Apr 7, 2020
@DL6ER DL6ER requested a review from a team April 7, 2020 10:35
@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/converting-dhcp-lease-to-static-php-error/28422/13

@PromoFaux
Copy link
Member

Do we want to do some kind of CreateIfNotExists? Or is that handled by something else?

@DL6ER
Copy link
Member Author

DL6ER commented Apr 21, 2020

No need to create it here as it will be created by the routine that adds the static lease when it does not exist.

https://github.com/pi-hole/AdminLTE/blob/cf0c7193ab3b4ad1d91ab2dff47b1596c009d63d/scripts/pi-hole/php/savesettings.php#L227

@DL6ER DL6ER merged commit c1ddf66 into release/v5.0 Apr 21, 2020
@DL6ER DL6ER deleted the fix/dhcp_static_error branch April 21, 2020 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants