Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Call to a member function get_name() on null in phar #7

Closed
the6thBook opened this issue Aug 3, 2018 · 8 comments
Closed

Call to a member function get_name() on null in phar #7

the6thBook opened this issue Aug 3, 2018 · 8 comments

Comments

@the6thBook
Copy link

I'm just trying to run this with out a configuration file:
php progpilot.phar someFile.php

This is the result I get:
PHP Fatal error: Uncaught Error: Call to a member function get_name() on null in phar:///home/centos/progpilot/progpilot.phar/vendor/progpilot/package/src/progpilot/Inputs/MyInputs.php:310
Stack trace:
#0 phar:///home/centos/progpilot/progpilot.phar/vendor/progpilot/package/src/progpilot/Analysis/SecurityAnalysis.php(93): progpilot\Inputs\MyInputs->get_sink_byname(Object(progpilot\Context), Array, Object(progpilot\Objects\MyFunction), NULL)
#1 phar:///home/centos/progpilot/progpilot.phar/vendor/progpilot/package/src/progpilot/Analysis/TaintAnalysis.php(40): progpilot\Analysis\SecurityAnalysis::funccall(Array, Object(progpilot\Context), Object(progpilot\Code\MyInstruction), NULL)
#2 phar:///home/centos/progpilot/progpilot.phar/vendor/progpilot/package/src/progpilot/Analysis/VisitorAnalysis.php(461): progpilot\Analysis\TaintAnalysis::funccall_specify_analysis(NULL, Array, Object(progpilot\Context), Array, NULL, Object(progpilot\Objects\MyFunction), false, Object(progpilot\Code\MyInstruction), Object(progpilot\Code\MyCode), 858) in phar:///home/centos/progpilot/progpilot.phar/vendor/progpilot/package/src/progpilot/Inputs/MyInputs.php on line 310

@eric-therond
Copy link
Collaborator

could you share your inputs :

  • someFile.php
  • version of progpilot
  • your version of php

@the6thBook
Copy link
Author

  • not at this time, I'll need to sanitize it.
    -This is the progpilot_v0.3.0.phar version
    -7.0.30-1.w7

It works on the propilto_v0.2.0.phar version. Is there any more information on the configuration file? I'd like my output as csv or json or something other than the var_dump.

Thanks

@the6thBook the6thBook reopened this Aug 4, 2018
@coderintherye
Copy link

experiencing a very similar error with the 0.3.0 phar
php 7.0.22

PHP Fatal error: Uncaught Error: Call to a member function add_type() on null in phar:///kdir/progpilot_v0.3.0.phar/vendor/progpilot/package/src/progpilot/Analysis/TaintAnalysis.php:381
Stack trace:
#0 phar:///kdir/progpilot_v0.3.0.phar/vendor/progpilot/package/src/progpilot/Analysis/TaintAnalysis.php(37): progpilot\Analysis\TaintAnalysis::funccall_source(Array, Object(progpilot\Context), Array, NULL, Object(progpilot\Code\MyInstruction))
#1 phar:///kdir/progpilot_v0.3.0.phar/vendor/progpilot/package/src/progpilot/Analysis/VisitorAnalysis.php(360): progpilot\Analysis\TaintAnalysis::funccall_specify_analysis(NULL, Array, Object(progpilot\Context), Array, NULL, Object(progpilot\Objects\MyFunction), false, Object(progpilot\Code\MyInstruction), Object(progpilot\Code\MyCode), 74)
#2 phar:///kdir/progpilot_v0.3.0.phar/vendor/progpilot/package/src/progpilot/Analyzer.php(139): progpilot\Analysis\VisitorAnalysis->analyze(Object(progpilot\Code\MyCode))
#3 phar:///kdir/progpilot_v0.3.0.phar/vendor/progpilot/pack in phar:///kdir/progpilot_v0.3.0.phar/vendor/progpilot/package/src/progpilot/Analysis/TaintAnalysis.php on line 381

Fatal error: Uncaught Error: Call to a member function add_type() on null in phar:///kdir/progpilot_v0.3.0.phar/vendor/progpilot/package/src/progpilot/Analysis/TaintAnalysis.php on line 381

Error: Call to a member function add_type() on null in phar:///kdir/progpilot_v0.3.0.phar/vendor/progpilot/package/src/progpilot/Analysis/TaintAnalysis.php on line 381

Call Stack:
0.0113 1078800 1. {main}() /kdir/progpilot_v0.3.0.phar:0
0.0113 1073616 2. require('phar:///kdir/progpilot_v0.3.0.phar/progpilot') /kdir/progpilot_v0.3.0.phar:12
0.0167 1857344 3. progpilot\Console\Application->run() phar:///kdir/progpilot_v0.3.0.phar/progpilot:19
0.0167 1857344 4. Symfony\Component\Console\Application->run() phar:///kdir/progpilot_v0.3.0.phar/vendor/progpilot/package/src/progpilot/Console/Application.php:33
0.0246 2114448 5. Symfony\Component\Console\Application->doRun() phar:///kdir/progpilot_v0.3.0.phar/vendor/symfony/console/Application.php:148
0.0247 2114448 6. Symfony\Component\Console\Application->doRunCommand() phar:///kdir/progpilot_v0.3.0.phar/vendor/symfony/console/Application.php:248
0.0247 2114448 7. Symfony\Component\Console\Command\Command->run() phar:///kdir/progpilot_v0.3.0.phar/vendor/symfony/console/Application.php:946
0.0250 2119120 8. progpilot\Command\ProgpilotCommand->execute() phar:///kdir/progpilot_v0.3.0.phar/vendor/symfony/console/Command/Command.php:252
0.0278 2552848 9. progpilot\Analyzer->run() phar:///kdir/progpilot_v0.3.0.phar/vendor/progpilot/package/src/progpilot/Command/ProgpilotCommand.php:61
145.7801 54462768 10. progpilot\Analyzer->run_internal() phar:///kdir/progpilot_v0.3.0.phar/vendor/progpilot/package/src/progpilot/Analyzer.php:318
146.1680 42081936 11. progpilot\Analyzer->run_internal_function() phar:///kdir/progpilot_v0.3.0.phar/vendor/progpilot/package/src/progpilot/Analyzer.php:230
146.1680 42075288 12. progpilot\Analysis\VisitorAnalysis->analyze() phar:///kdir/progpilot_v0.3.0.phar/vendor/progpilot/package/src/progpilot/Analyzer.php:139
146.1725 42094504 13. progpilot\Analysis\TaintAnalysis::funccall_specify_analysis() phar:///kdir/progpilot_v0.3.0.phar/vendor/progpilot/package/src/progpilot/Analysis/VisitorAnalysis.php:360
146.1729 42094992 14. progpilot\Analysis\TaintAnalysis::funccall_source() phar:///kdir/progpilot_v0.3.0.phar/vendor/progpilot/package/src/progpilot/Analysis/TaintAnalysis.php:37

@eric-therond
Copy link
Collaborator

hello @coderintherye
could you provide the files or code you try to analyze so I will be able to reproduce the bug

thank you

Eric

@coderintherye
Copy link

@eric-therond any suggestions on how to figure out the exact file it is failing on (is there an extra logging flag or something)? I'm running it across a large codebase, and I can't tell from the output exactly which file is causing the issue

@eric-therond
Copy link
Collaborator

yes, for the 0.3.0 version of progpilot, if you are using the API you could use :

$context->set_pretty_print(true);

or if you use a configuration file :

set_print_file: true

to print the analyzed files during the execution of progpilot

Eric

@the6thBook
Copy link
Author

Still haven't found the issue. I comment some lines out it the error goes away, but if I add them to a separate file, I don't get the error.

@the6thBook
Copy link
Author

It looks like the current dev build addresses my "get_name()" issue. It looks like there is a null check on line 303 in MyInputs.php, maybe that wasn't there in the 0.30 version.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants