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

Monolog/Utils class cannot access expandIniShorthandBytes() method. #1627

Closed
sashi-geeks opened this issue Jan 19, 2022 · 4 comments
Closed
Labels

Comments

@sashi-geeks
Copy link

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.

@mfn
Copy link

mfn commented 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.

@sashi-geeks
Copy link
Author

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?

@mfn
Copy link

mfn commented 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.

@Seldaek
Copy link
Owner

Seldaek commented 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.

@Seldaek Seldaek closed this as completed Mar 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants