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
Added ErrorException handler. #1
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@xaav As I said in your previous PR, you are only setting an error handler for the testsuite, which is totally useless as this is already done by PHPUnit when you configure it to do it (and it let the user change it through its PHPUnit config). So this change is just useless |
naderman
referenced
this issue
in naderman/composer
Sep 25, 2011
naderman
added a commit
that referenced
this issue
Apr 29, 2012
Closed
digitalkaoz
pushed a commit
to digitalkaoz/composer
that referenced
this issue
Nov 22, 2013
digitalkaoz
pushed a commit
to digitalkaoz/composer
that referenced
this issue
Nov 22, 2013
digitalkaoz
pushed a commit
to digitalkaoz/composer
that referenced
this issue
Nov 22, 2013
Whitelist dependencies
Closed
jrfnl
added a commit
to jrfnl/composer
that referenced
this issue
Aug 5, 2021
The default state for the `TransportException::$response` property is unset and - as testified by the notice in tests -, the `$response` may not be set, resulting in a `null` return value from `TransportException::getResponse()`. Casting to string will preserve the existing behaviour. Fixes: ``` Deprecation triggered by Composer\Test\Util\GitLabTest::testUsernamePasswordFailure: json_decode(): Passing null to parameter composer#1 ($json) of type string is deprecated Stack trace: 0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 133) 1 src/Composer/Util/GitLab.php(133): json_decode(NULL, true) 2 tests/Composer/Test/Util/GitLabTest.php(108): Composer\Util\GitLab->authorizeOAuthInteractively('...', '...') ... ```
jrfnl
added a commit
to jrfnl/composer
that referenced
this issue
Aug 5, 2021
The default state for the `Perforce::$p4DepotType` property is unset and - as testified by the notice in tests -, the `$p4DepotType` may not be set, resulting in a `null` value being passed to the PHP native `strcmp()` function from within the `p4DepotType::isStream()` method. Casting to string will preserve the existing behaviour. Fixes various notices along the lines of: ``` Deprecation triggered by Composer\Test\Repository\Vcs\PerforceDriverTest::testInitializeCapturesVariablesFromRepoConfig: strcmp(): Passing null to parameter composer#1 ($string1) of type string is deprecated Stack trace: 0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 163) 1 src/Composer/Util/Perforce.php(163): strcmp(NULL, '...') 2 src/Composer/Util/Perforce.php(169): Composer\Util\Perforce->isStream() 3 src/Composer/Util/Perforce.php(127): Composer\Util\Perforce->getStream() 4 src/Composer/Util/Perforce.php(191): Composer\Util\Perforce->getClient() 5 src/Composer/Util/Perforce.php(350): Composer\Util\Perforce->getP4ClientSpec() 6 src/Composer/Repository/Vcs/PerforceDriver.php(46): Composer\Util\Perforce->writeP4ClientSpec() 7 tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php(117): Composer\Repository\Vcs\PerforceDriver->initialize() ... ```
jrfnl
added a commit
to jrfnl/composer
that referenced
this issue
Aug 5, 2021
The default state for the `Perforce::$p4DepotType` property is unset and - as testified by the notice in tests -, the `$p4DepotType` may not be set, resulting in a `null` value being passed to the PHP native `strcmp()` function from within the `p4DepotType::isStream()` method. Casting to string will preserve the existing behaviour. Fixes various notices along the lines of: ``` Deprecation triggered by Composer\Test\Repository\Vcs\PerforceDriverTest::testInitializeCapturesVariablesFromRepoConfig: strcmp(): Passing null to parameter composer#1 ($string1) of type string is deprecated Stack trace: 0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 163) 1 src/Composer/Util/Perforce.php(163): strcmp(NULL, '...') 2 src/Composer/Util/Perforce.php(169): Composer\Util\Perforce->isStream() 3 src/Composer/Util/Perforce.php(127): Composer\Util\Perforce->getStream() 4 src/Composer/Util/Perforce.php(191): Composer\Util\Perforce->getClient() 5 src/Composer/Util/Perforce.php(350): Composer\Util\Perforce->getP4ClientSpec() 6 src/Composer/Repository/Vcs/PerforceDriver.php(46): Composer\Util\Perforce->writeP4ClientSpec() 7 tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php(117): Composer\Repository\Vcs\PerforceDriver->initialize() ... ```
jrfnl
added a commit
to jrfnl/composer
that referenced
this issue
Aug 5, 2021
The default state for the `Perforce::$p4DepotType` property is unset and - as testified by the notice in tests -, the `$p4DepotType` may not be set, resulting in a `null` value being passed to the PHP native `strcmp()` function from within the `p4DepotType::isStream()` method. Casting to string will preserve the existing behaviour. Fixes various notices along the lines of: ``` Deprecation triggered by Composer\Test\Repository\Vcs\PerforceDriverTest::testInitializeCapturesVariablesFromRepoConfig: strcmp(): Passing null to parameter composer#1 ($string1) of type string is deprecated Stack trace: 0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 163) 1 src/Composer/Util/Perforce.php(163): strcmp(NULL, '...') 2 src/Composer/Util/Perforce.php(169): Composer\Util\Perforce->isStream() 3 src/Composer/Util/Perforce.php(127): Composer\Util\Perforce->getStream() 4 src/Composer/Util/Perforce.php(191): Composer\Util\Perforce->getClient() 5 src/Composer/Util/Perforce.php(350): Composer\Util\Perforce->getP4ClientSpec() 6 src/Composer/Repository/Vcs/PerforceDriver.php(46): Composer\Util\Perforce->writeP4ClientSpec() 7 tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php(117): Composer\Repository\Vcs\PerforceDriver->initialize() ... ```
jrfnl
added a commit
to jrfnl/composer
that referenced
this issue
Aug 12, 2021
The return type of the `Rule::getRequiredPackage()` method effectively was `?string` as, if no matching reason was found, the function wasn't returning anything. In PHP 8.1, this results in 97 notices along the lines of the below from existing tests: ``` Deprecation triggered by Composer\Test\DependencyResolver\SolverTest::testConflictResultEmpty: strpos(): Passing null to parameter composer#1 ($haystack) of type string is deprecated Stack trace: 0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 111) 1 src/Composer/DependencyResolver/SolverProblemsException.php(111): strpos(NULL, '...') 2 src/Composer/DependencyResolver/SolverProblemsException.php(44): Composer\DependencyResolver\SolverProblemsException->hasExtensionProblems(Array) 3 tests/Composer/Test/DependencyResolver/SolverTest.php(659): Composer\DependencyResolver\SolverProblemsException->getPrettyString(Object(Composer\Repository\RepositorySet), Object(Composer\DependencyResolver\Request), Object(Composer\DependencyResolver\Pool), false) .... ``` Fixed by returning an empty string if no reason was matched.
jrfnl
added a commit
to jrfnl/composer
that referenced
this issue
Aug 12, 2021
…ly fix) Not all tests in the `InstallerTest` class actually create a temporary directory and set the `$this->tempComposerHome` property. Those tests which didn't, throw a notice in PHP 8.1. Fixes 3 notices along the lines of: ``` Deprecation triggered by Composer\Test\InstallerTest::tearDown: is_dir(): Passing null to parameter composer#1 ($filename) of type string is deprecated Stack trace: 0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 53) 1 tests/Composer/Test/InstallerTest.php(53): is_dir(NULL) ... ```
jrfnl
added a commit
to jrfnl/composer
that referenced
this issue
Aug 12, 2021
The default state for the `ProcessExecutor::$errorOutput` property is "not set" and if there has been no error during the execution of the process, it may well still be, resulting in the return value of `$this->process->getErrorOutput()` being `null`. In that case, we may as well bypass the whole `foreach` as it will never match any of the recognized authentication failure messages. Fixes a total of 5 deprecation notices along the lines of: ``` Deprecation triggered by Composer\Test\Downloader\GitDownloaderTest::testDownloadThrowsRuntimeExceptionIfGitCommandFails: strpos(): Passing null to parameter composer#1 ($haystack) of type string is deprecated Stack trace: 0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 340) 1 src/Composer/Util/Git.php(340): strpos(NULL, '...') 2 src/Composer/Util/Git.php(200): Composer\Util\Git->isAuthenticationFailure('...', Array) 3 src/Composer/Downloader/GitDownloader.php(121): Composer\Util\Git->runCommand(Object(Closure), '...', NULL, true) 4 src/Composer/Downloader/VcsDownloader.php(137): Composer\Downloader\GitDownloader->doInstall(Object(Mock_PackageInterface_f8be9ebd), '...', '...') 5 tests/Composer/Test/Downloader/GitDownloaderTest.php(349): Composer\Downloader\VcsDownloader->install(Object(Mock_PackageInterface_f8be9ebd), '...') ... ```
jrfnl
added a commit
to jrfnl/composer
that referenced
this issue
Aug 12, 2021
The `LibraryInstallerTest::testUninstall()` method mocks a `Package` object, but did not set an expectation for a call to `getName()`, while that method _is_ called in the `LibraryInstaller::uninstall()` method. Without expectation, the mock returns `null`, which was subsequently being passed on to `strpos()` leading to the below error. Fixes: ``` Deprecation triggered by Composer\Test\Installer\LibraryInstallerTest::testUninstall: strpos(): Passing null to parameter composer#1 ($haystack) of type string is deprecated Stack trace: 0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 202) 1 src/Composer/Installer/LibraryInstaller.php(202): strpos(NULL, '...') 2 vendor/react/promise/src/FulfilledPromise.php(28): Composer\Installer\LibraryInstaller->Composer\Installer\{closure}(NULL) 3 src/Composer/Installer/LibraryInstaller.php(208): React\Promise\FulfilledPromise->then(Object(Closure)) 4 tests/Composer/Test/Installer/LibraryInstallerTest.php(221): Composer\Installer\LibraryInstaller->uninstall(Object(Mock_InstalledRepositoryInterface_e3699f95), Object(Mock_Package_e4571076)) ... ```
jrfnl
added a commit
to jrfnl/composer
that referenced
this issue
Aug 12, 2021
The default state for the `ProcessExecutor::$errorOutput` property is "not set" and if there has been no error during the execution of the process, it may well still be, resulting in the return value of `$this->process->getErrorOutput()` being `null`. In that case, we may as well bypass the whole `foreach` as it will never match any of the recognized authentication failure messages. Includes correcting the return type for the `ProcessExecutor::getErrorOutput()` method. There are several alternative solutions possible here: * Set a default value for the `ProcessExecutor::$errorOutput` property of an empty string. * Check within the `ProcessExecutor::getErrorOutput()` method whether the property is set and if not, return an empty string. Not sure what is the best solution, please provide guidance. Fixes a total of 5 deprecation notices along the lines of: ``` Deprecation triggered by Composer\Test\Downloader\GitDownloaderTest::testDownloadThrowsRuntimeExceptionIfGitCommandFails: strpos(): Passing null to parameter composer#1 ($haystack) of type string is deprecated Stack trace: 0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 340) 1 src/Composer/Util/Git.php(340): strpos(NULL, '...') 2 src/Composer/Util/Git.php(200): Composer\Util\Git->isAuthenticationFailure('...', Array) 3 src/Composer/Downloader/GitDownloader.php(121): Composer\Util\Git->runCommand(Object(Closure), '...', NULL, true) 4 src/Composer/Downloader/VcsDownloader.php(137): Composer\Downloader\GitDownloader->doInstall(Object(Mock_PackageInterface_f8be9ebd), '...', '...') 5 tests/Composer/Test/Downloader/GitDownloaderTest.php(349): Composer\Downloader\VcsDownloader->install(Object(Mock_PackageInterface_f8be9ebd), '...') ... ```
glaubinix
added a commit
to glaubinix/composer
that referenced
this issue
Feb 9, 2022
…of type array, null given
glaubinix
added a commit
to glaubinix/composer
that referenced
this issue
Feb 9, 2022
…of type array, null given
glaubinix
added a commit
to glaubinix/composer
that referenced
this issue
Jun 24, 2022
…mposer#1 () must be of type string, int given
glaubinix
added a commit
to glaubinix/composer
that referenced
this issue
Jun 24, 2022
…mposer#1 () must be of type string, int given
glaubinix
added a commit
to glaubinix/composer
that referenced
this issue
Jun 24, 2022
…mposer#1 () must be of type string, int given
Seldaek
pushed a commit
that referenced
this issue
Jun 24, 2022
…ust be of type string, int given (#10897)
Closed
ktomk
added a commit
to ktomk/composer
that referenced
this issue
Jun 30, 2022
Fix string type requirement in case of NULL value: [TypeError] Composer\Command\InitCommand::parseAuthorString(): Argument composer#1 ($author) must be of type string, null given, called in phar:///composer.phar/src/Composer/Command/InitCommand.php on line 345
Seldaek
pushed a commit
that referenced
this issue
Jul 1, 2022
Fix string type requirement in case of NULL value: [TypeError] Composer\Command\InitCommand::parseAuthorString(): Argument #1 ($author) must be of type string, null given, called in phar:///composer.phar/src/Composer/Command/InitCommand.php on line 345
Seldaek
pushed a commit
that referenced
this issue
Jul 1, 2022
Fix string type requirement in case of NULL value: [TypeError] Composer\Command\InitCommand::parseAuthorString(): Argument #1 ($author) must be of type string, null given, called in phar:///composer.phar/src/Composer/Command/InitCommand.php on line 345
Seldaek
pushed a commit
that referenced
this issue
Jul 1, 2022
Fix string type requirement in case of NULL value: [TypeError] Composer\Command\InitCommand::parseAuthorString(): Argument #1 ($author) must be of type string, null given, called in phar:///composer.phar/src/Composer/Command/InitCommand.php on line 345
fluffycondor
referenced
this issue
in fluffycondor/composer
Jul 4, 2022
Deprecation Notice: trim(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///usr/bin/composer/src/Composer/Util/GitHub.php:103
fluffycondor
referenced
this issue
in fluffycondor/composer
Jul 4, 2022
Deprecation Notice: trim(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///usr/bin/composer/src/Composer/Util/GitHub.php:103
Seldaek
pushed a commit
that referenced
this issue
Jul 5, 2022
Deprecation Notice: trim(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///usr/bin/composer/src/Composer/Util/GitHub.php:103
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Changed errors to exceptions, because: