[GH-ISSUE #1627] Monolog/Utils class cannot access expandIniShorthandBytes() method. #691

Closed
opened 2026-03-04 02:17:05 +03:00 by kerem · 4 comments
Owner

Originally created by @sashi-geeks on GitHub (Jan 19, 2022).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1627

Environment details

  • OS: Linux
  • PHP version: 7.4
  • Package name and version: Google Api client Google\Client v2.12.11 and Monolog 2.3.5

Steps to reproduce

  1. When google Client class tries to build a Default Logger using method createDefaultLogger() at line 1124 the monolog StreamHandler class constructor cannot find expandIniShorthandBytes() in Monolog\Utils class.

Following is the stacktrace from
Error: Call to undefined method Monolog\Utils::expandIniShorthandBytes() in /home/portalgeek/public_html/modules/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:58
Stack trace:
#0 /home/portalgeek/public_html/modules/vendor/google/apiclient/src/Client.php(1136): Monolog\Handler\StreamHandler->__construct('php://stderr', 250)
#1 /home/portalgeek/public_html/modules/vendor/google/apiclient/src/Client.php(1124): Google\Client->createDefaultLogger()
#2 /home/portalgeek/public_html/modules/vendor/google/apiclient/src/Service/Resource.php(162): Google\Client->getLogger()
#3 /home/portalgeek/public_html/modules/vendor/google/apiclient-services/src/Directory/Resource/Users.php(70): Google\Service\Resource->call('get', Array, 'Google\Service\...')
#4 /home/portalgeek/public_html/modules/addons/merlin_module/GClient2.php(65): Google\Service\Directory\Resource\Users->get(NULL)

There seems to be some lib conflict between Google and Monolog on expandIniShorthandBytes(). Did anyone have this same issue? I tried looking on the internet for something but no clues.

Originally created by @sashi-geeks on GitHub (Jan 19, 2022). Original GitHub issue: https://github.com/Seldaek/monolog/issues/1627 #### Environment details - OS: Linux - PHP version: 7.4 - Package name and version: Google Api client Google\Client v2.12.11 and Monolog 2.3.5 #### Steps to reproduce 1. When google Client class tries to build a Default Logger using method createDefaultLogger() at line 1124 the monolog StreamHandler class constructor cannot find expandIniShorthandBytes() in Monolog\Utils class. Following is the stacktrace from Error: Call to undefined method Monolog\Utils::expandIniShorthandBytes() in /home/portalgeek/public_html/modules/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:58 Stack trace: #0 /home/portalgeek/public_html/modules/vendor/google/apiclient/src/Client.php(1136): Monolog\Handler\StreamHandler->__construct('php://stderr', 250) #1 /home/portalgeek/public_html/modules/vendor/google/apiclient/src/Client.php(1124): Google\Client->createDefaultLogger() #2 /home/portalgeek/public_html/modules/vendor/google/apiclient/src/Service/Resource.php(162): Google\Client->getLogger() #3 /home/portalgeek/public_html/modules/vendor/google/apiclient-services/src/Directory/Resource/Users.php(70): Google\Service\Resource->call('get', Array, 'Google\\Service\\...') #4 /home/portalgeek/public_html/modules/addons/merlin_module/GClient2.php(65): Google\Service\Directory\Resource\Users->get(NULL) There seems to be some lib conflict between Google and Monolog on expandIniShorthandBytes(). Did anyone have this same issue? I tried looking on the internet for something but no clues.
kerem 2026-03-04 02:17:05 +03:00
  • closed this issue
  • added the
    Bug
    label
Author
Owner

@mfn commented on GitHub (Jan 19, 2022):

I'm running the exact same versions in multiple projects, never saw this (but my setup might differ to not trigger this code path, so 🤷🏼 ).

StreamHandler and Utils are both within the monolog/monolog package and come together. The only way I can think they don't match is if you manually uploaded the files and it missed to update Utils or so.

<!-- gh-comment-id:1016457162 --> @mfn commented on GitHub (Jan 19, 2022): I'm running the exact same versions in multiple projects, never saw this (but my setup might differ to not trigger this code path, so 🤷🏼 ). `StreamHandler` and `Utils` are both within the monolog/monolog package and come together. The only way I can think they don't match is if you manually uploaded the files and it missed to update Utils or so.
Author
Owner

@sashi-geeks commented on GitHub (Jan 20, 2022):

The Monolog was updated using composer and I can verify that Utils has mentioned the method in the vendor folder. And this is for an application called WHMCS. I also notice this application has multiple vendor folders. but I verified that the stack trace path for Utils has the mentioned method as well. Can multiple autoload cause a conflict in the Utils version?

<!-- gh-comment-id:1016991524 --> @sashi-geeks commented on GitHub (Jan 20, 2022): The Monolog was updated using composer and I can verify that Utils has mentioned the method in the vendor folder. And this is for an application called WHMCS. I also notice this application has multiple vendor folders. but I verified that the stack trace path for Utils has the mentioned method as well. Can multiple autoload cause a conflict in the Utils version?
Author
Owner

@mfn commented on GitHub (Jan 20, 2022):

Yes, this is possible and I've experienced this. Autloading happens in order and maybe an older version of that class is loaded prior.

I don't know what WHCMS is, but I suggest to check with them.

Doesn't look like a monolog issue to me though.

<!-- gh-comment-id:1017150494 --> @mfn commented on GitHub (Jan 20, 2022): Yes, this is possible and I've experienced this. Autloading happens in order and maybe an older version of that class is loaded prior. I don't know what WHCMS is, but I suggest to check with them. Doesn't look like a monolog issue to me though.
Author
Owner

@Seldaek commented on GitHub (Mar 13, 2022):

Yeah definitely an autoload issue with multiple vendor dirs having different monolog versions and one loading before the other somehow. Nothing we can fix here.

<!-- gh-comment-id:1066168514 --> @Seldaek commented on GitHub (Mar 13, 2022): Yeah definitely an autoload issue with multiple vendor dirs having different monolog versions and one loading before the other somehow. Nothing we can fix here.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#691
No description provided.