-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
Fails to Process Files with Dynamic Class Instantiation and Direct String Parameters #1108
Comments
Can you try to execute the command in debug mode, i.e. with |
Oh, right! That showed an error! I removed most of the successful files from the output below. I can note that I counted 119 [OK] files and 1 [NO]. But it still says $ rm -rf online-shared
$ php vendor/humbug/php-scoper/bin/php-scoper -vvv add-prefix
> Using the configuration file "/mnt/c/Users/OskarModig/dev/git/sync/scoper.inc.php".
>
> ____ __ ______ _____
> / __ \/ / / / __ \ / ___/_________ ____ ___ _____
> / /_/ / /_/ / /_/ / \__ \/ ___/ __ \/ __ \/ _ \/ ___/
> / ____/ __ / ____/ ___/ / /__/ /_/ / /_/ / __/ /
> /_/ /_/ /_/_/ /____/\___/\____/ .___/\___/_/
> /_/
>
> PhpScoper version 0.18.16@aff0ef9
>
> Input
> -----
>
> Prefix: Online_Shared_Sync
> Paths: Loaded from config
> Processing
> ----------
>
> * [OK] /mnt/c/Users/OskarModig/dev/git/sync/vendor/oskarmodig/online-shared/includes/Abstracts/Data_Model.php
> ...
> * [NO] /mnt/c/Users/OskarModig/dev/git/sync/vendor/oskarmodig/online-shared/includes/Modules/Sync_Module.php
> Could not parse the file "/mnt/c/Users/OskarModig/dev/git/sync/vendor/oskarmodig/online-shared/includes/Modules/Sync_Module.php".: > Humbug\PhpScoper\PhpParser\UnexpectedParsingScenario: Unexpected case. Please report it. in /mnt/c/Users/OskarModig/dev/git/sync/vendor/humbug/php-scoper/src/> PhpParser/UnexpectedParsingScenario.php:23
> Stack trace:
> #0 /mnt/c/Users/OskarModig/dev/git/sync/vendor/humbug/php-scoper/src/PhpParser/NodeVisitor/StringScalarPrefixer.php(216): > Humbug\PhpScoper\PhpParser\UnexpectedParsingScenario::create()
> #1 /mnt/c/Users/OskarModig/dev/git/sync/vendor/humbug/php-scoper/src/PhpParser/NodeVisitor/StringScalarPrefixer.php(195): > Humbug\PhpScoper\PhpParser\NodeVisitor\StringScalarPrefixer->prefixNewStringArg()
> #2 /mnt/c/Users/OskarModig/dev/git/sync/vendor/humbug/php-scoper/src/PhpParser/NodeVisitor/StringScalarPrefixer.php(166): > Humbug\PhpScoper\PhpParser\NodeVisitor\StringScalarPrefixer->prefixStringArg()
> #3 /mnt/c/Users/OskarModig/dev/git/sync/vendor/humbug/php-scoper/src/PhpParser/NodeVisitor/StringScalarPrefixer.php(135): > Humbug\PhpScoper\PhpParser\NodeVisitor\StringScalarPrefixer->prefixStringScalar()
> #4 /mnt/c/Users/OskarModig/dev/git/sync/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(114): > Humbug\PhpScoper\PhpParser\NodeVisitor\StringScalarPrefixer->enterNode()
> #5 /mnt/c/Users/OskarModig/dev/git/sync/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(227): PhpParser\NodeTraverser->traverseNode()
> #6 /mnt/c/Users/OskarModig/dev/git/sync/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(98): PhpParser\NodeTraverser->traverseArray()
> #7 /mnt/c/Users/OskarModig/dev/git/sync/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(139): PhpParser\NodeTraverser->traverseNode()
> #8 /mnt/c/Users/OskarModig/dev/git/sync/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(139): PhpParser\NodeTraverser->traverseNode()
> #9 /mnt/c/Users/OskarModig/dev/git/sync/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(227): PhpParser\NodeTraverser->traverseNode()
> #10 /mnt/c/Users/OskarModig/dev/git/sync/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(98): PhpParser\NodeTraverser->traverseArray()
> #11 /mnt/c/Users/OskarModig/dev/git/sync/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(227): PhpParser\NodeTraverser->traverseNode()
> #12 /mnt/c/Users/OskarModig/dev/git/sync/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(98): PhpParser\NodeTraverser->traverseArray()
> #13 /mnt/c/Users/OskarModig/dev/git/sync/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(227): PhpParser\NodeTraverser->traverseNode()
> #14 /mnt/c/Users/OskarModig/dev/git/sync/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(98): PhpParser\NodeTraverser->traverseArray()
> #15 /mnt/c/Users/OskarModig/dev/git/sync/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(227): PhpParser\NodeTraverser->traverseNode()
> #16 /mnt/c/Users/OskarModig/dev/git/sync/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(76): PhpParser\NodeTraverser->traverseArray()
> #17 /mnt/c/Users/OskarModig/dev/git/sync/vendor/humbug/php-scoper/src/PhpParser/NodeTraverser.php(59): PhpParser\NodeTraverser->traverse()
> #18 /mnt/c/Users/OskarModig/dev/git/sync/vendor/humbug/php-scoper/src/Scoper/PhpScoper.php(65): Humbug\PhpScoper\PhpParser\NodeTraverser->traverse()
> #19 /mnt/c/Users/OskarModig/dev/git/sync/vendor/humbug/php-scoper/src/Scoper/PhpScoper.php(52): Humbug\PhpScoper\Scoper\PhpScoper->scopePhp()
> #20 /mnt/c/Users/OskarModig/dev/git/sync/vendor/humbug/php-scoper/src/Scoper/PatchScoper.php(34): Humbug\PhpScoper\Scoper\PhpScoper->scope()
> #21 /mnt/c/Users/OskarModig/dev/git/sync/vendor/humbug/php-scoper/src/Console/ConsoleScoper.php(332): Humbug\PhpScoper\Scoper\PatchScoper->scope()
> #22 /mnt/c/Users/OskarModig/dev/git/sync/vendor/humbug/php-scoper/src/Console/ConsoleScoper.php(201): Humbug\PhpScoper\Console\ConsoleScoper->scopeFile()
> #23 /mnt/c/Users/OskarModig/dev/git/sync/vendor/humbug/php-scoper/src/Console/ConsoleScoper.php(113): Humbug\PhpScoper\Console\ConsoleScoper->scopeFiles()
> #24 /mnt/c/Users/OskarModig/dev/git/sync/vendor/humbug/php-scoper/src/Console/ConsoleScoper.php(81): Humbug\PhpScoper\Console\ConsoleScoper->doScope()
> #25 /mnt/c/Users/OskarModig/dev/git/sync/vendor/humbug/php-scoper/src/Console/Command/AddPrefixCommand.php(160): Humbug\PhpScoper\Console\ConsoleScoper->scope()
> #26 /mnt/c/Users/OskarModig/dev/git/sync/vendor/fidry/console/src/Bridge/Command/SymfonyCommand.php(103): Humbug\PhpScoper\Console\Command\AddPrefixCommand->execute()
> #27 /mnt/c/Users/OskarModig/dev/git/sync/vendor/symfony/console/Command/Command.php(279): Fidry\Console\Bridge\Command\SymfonyCommand->execute()
> #28 /mnt/c/Users/OskarModig/dev/git/sync/vendor/symfony/console/Application.php(1076): Symfony\Component\Console\Command\Command->run()
> #29 /mnt/c/Users/OskarModig/dev/git/sync/vendor/symfony/console/Application.php(342): Symfony\Component\Console\Application->doRunCommand()
> #30 /mnt/c/Users/OskarModig/dev/git/sync/vendor/symfony/console/Application.php(193): Symfony\Component\Console\Application->doRun()
> #31 /mnt/c/Users/OskarModig/dev/git/sync/vendor/fidry/console/src/Application/ApplicationRunner.php(83): Symfony\Component\Console\Application->run()
> #32 /mnt/c/Users/OskarModig/dev/git/sync/vendor/fidry/console/src/Application/ApplicationRunner.php(62): Fidry\Console\Application\ApplicationRunner->run()
> #33 /mnt/c/Users/OskarModig/dev/git/sync/vendor/humbug/php-scoper/bin/php-scoper(64): Fidry\Console\Application\ApplicationRunner::runApplication()
> #34 {main}
> * [OK] /mnt/c/Users/OskarModig/dev/git/sync/vendor/oskarmodig/online-shared/includes/Modules/Template_Loader_Module.php
> ...
>
>
>
> [OK] Successfully prefixed 120 files.
>
>
> // Memory usage: 14.92MB (peak: 21.61MB), time: 10.13s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
php-scoper
seems to silently skip files containing dynamic class instantiation when a direct string value is passed as a parameter to the class constructor. The issue occurs when a string literal is passed directly, but the problem does not occur when the string is stored in a variable or within an array. This behavior is inconsistent and leads to skipped files in certain scenarios.Tested files
Test File 1 (Works):
Test File 2 (Fails):
Test File 3 (Works - String in Variable):
Test File 4 (Works - String in Array):
Expected Behavior
Actual Behavior
scoper.inc.php
Output
The text was updated successfully, but these errors were encountered: