mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-27 00:25:50 +03:00
[GH-ISSUE #1866] cannot access private method #798
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#798
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @buexplain on GitHub (Jan 5, 2024).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1866
Monolog version 3
@Seldaek commented on GitHub (Apr 12, 2024):
This is weird.. I can't reproduce it (https://3v4l.org/ZHA87) and I don't really see why it would do this as the callback is only used within the context of StreamHandler /cc @corentin-cres
@lcharette commented on GitHub (Apr 13, 2024):
I was able to replicate this UserFrosting by removing write permission to the log file, which resulted in a similar error message :
Using the example above (https://3v4l.org/ZHA87) on the same environment and on the same file (without write access) returned the proper output :
The difference is our app use a custom StreamWrapper. So the core PHP
fopenisn't actually called by Monolog's StreamHandler, but our own. And both will invokecustomErrorHandler, which won't work on our side since the method is private. Therefore,customErrorHandlermust be public.Note the actual process when
customErrorHandleris public is similar to this :fopenfopenfopentrows an exceptioncustomErrorHandler(even if we use@fopen), then do the rest of it's job and returnfalse.customErrorHandleragain@lcharette commented on GitHub (Apr 13, 2024):
Here's a way to replicate : https://3v4l.org/PjtpI(Forget theopen_basedir restriction in effecterror... that means it's working, simply I can't replicate a non-writable file on the editor)There we go. Both should return "Failed to open stream" : https://3v4l.org/LsBph
@Seldaek commented on GitHub (Apr 13, 2024):
Great, thanks for the investigative work there! I guess maybe using a closure instead would be better, otherwise public method with an internal phpdoc.. Anyway I'll look at this next week
@Seldaek commented on GitHub (Apr 15, 2024):
@lcharette can you please check using dev-main if this problem is fixed for you?
@lcharette commented on GitHub (Apr 16, 2024):
I confirm problem is fixed with
dev-main. Thanks !@Seldaek commented on GitHub (Apr 17, 2024):
Great
@interactiveRob commented on GitHub (Sep 17, 2024):
just in case anyone else from Userfrosting winds up here and is wondering which log file @lcharette is talking about above. --
That would be the
/logs/userfrosting.logfile. In my case, the app did not have write permission on the log which triggered the same private method issue discussed here.