PHP Fatal error: Uncaught TypeError: get_class(): Argument #1 ($object) must be of type object, string given in /tmp/phpggc/lib/PHPGGC.php:284
Stack trace:
#0 /tmp/phpggc/lib/PHPGGC.php(804): PHPGGC->new_gc()
#1 /tmp/phpggc/lib/PHPGGC.php(44): PHPGGC->parse_cmdline()
#2 /tmp/phpggc/phpggc(12): PHPGGC->generate()
#3 {main}
thrown in /tmp/phpggc/lib/PHPGGC.php on line 284
Reproduce with docker image
sudo docker pull php:7.4
git clone git@github.com:ambionics/phpggc.git
cd phpggc
sudo docker run -v ./:/app php:7.4 php /app/phpggc -N Drupal RCE
Output:
Warning: get_class() expects parameter 1 to be object, string given in /app/lib/PHPGGC.php on line 284
Fatal error: Uncaught Error: Class name must be a valid object or a string in /app/lib/PHPGGC.php:286
Stack trace:
#0 /app/lib/PHPGGC.php(804): PHPGGC->new_gc('Drupal', 'RCE')
#1 /app/lib/PHPGGC.php(44): PHPGGC->parse_cmdline(Array)
#2 /app/phpggc(12): PHPGGC->generate()
#3 {main}
thrown in /app/lib/PHPGGC.php on line 286
Issue
The
-N
/--new
option doesn't seems to work.According to the error, this is due to the get_class() function in https://github.com/ambionics/phpggc/blob/master/lib/PHPGGC.php#L284 which expect an object rather than a string.
Step to reproduce
Output :
Reproduce with docker image
Output: