I'm currently trying to set-up satis to manage our internal packages using composer.
I have created my config.json file
{
"name": "Internal Packages",
"homepage": "http://packages.example.org",
"repositories": [
{ "type": "vcs", "url": "ssh://me#mypackages.com/Test-Component" }
],
"require-all": true
}
When I try and build it
php bin/satis build config.json web/
I get the following error:
[ErrorException]
rmdir(/home/lee.stone/.composer/cache): Directory not empty
Warning: You have xdebug.scream enabled, the warning above may be
a legitimately suppressed error that you were not supposed to see.
I have deleted that cache folder and tried to build again, but get the same error. Nothing has been created in my web directory either.
Any ideas on how to solve this problem so it will build succesfully?
Disable the xdebug.scream option of your command line PHP version.
Explanation of that option:
xdebug.scream
Type: boolean, Default value: 0, Introduced in Xdebug >= 2.1
If this setting is 1, then Xdebug will disable the # (shut-up) operator so that notices, warnings and errors are no longer hidden.
If the usage of # does not suppress the expected error when removing that directory in your installation, and that error triggers an exception that shouldn't exist in the first place.
Related
I'm trying to use XDebug on VSCode to debug a PHP 8.1 / CakePHP 4.3 project hosted on a local Docker container, but it always fails with this error:
2022-05-25 12:11:36 error: [Cake\Error\FatalErrorException] __debuginfo() must return an array in /var/www/repo/public/vendor/cakephp/cakephp/src/ORM/BehaviorRegistry.php on line 78
Stack Trace:
- /var/www/repo/public/vendor/cakephp/cakephp/src/Error/BaseErrorHandler.php:119
- [main] - [internal], line ??
This is my launch.json config:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"stopOnEntry": true,
"pathMappings": {
"/var/www/repo": "<path/to/my/local/project>"
}
},
]
}
If I set "stopOnEntry": true, XDebug correctly stops at the first line of the entrypoint of my project (I.E. the webroot/index.php file), but when I get to the $server->emit($server->run()); line, I get the error.
Same if I set "stopOnEntry": false, and set a breakpoint somewhere in my project (I.E. Application.php or Controller/AppController.php). No matter where I put the breakpoint, I always get the same error about __debuginfo().
What's going on here? Is CakePHP somehow incompatible with XDebug, because internally the framework is using the __debuginfo() incorrectly? Or does CakePHP 4 actually work with XDebug, and I'm doing something wrong in my own code (though I can't understand what or where) and the error is just cryptic? Does anybody have any experience with getting XDebug to work on a CakePHP 4 project correctly?
because internally the framework is using the __debuginfo incorrectly
Yes, that is likely it.
__debugInfo() must return an array.
Xdebug invokes __debugInfo() to obtain information information for some variables. If during the normal execution of a script this is never done, then the error will not show up, but because Xdebug does use it, you will run into this. I would suggest you report this to the Cake people as it is only something they can fix.
The problem is that your PHP version is 8.1.x and the CakePHP version that you use assumes an older PHP version which was more lenient with type enforcing of the types. You have several options:
you can downgrade to an older version of PHP
you can fix the code in CakePHP for the time being
you can send an error report to CakePHP
With PHP 8.1.x the : sometype specifications are enforced and they were not enforced previously.
I installed SIMPLESAMLPHP library with composer using
composer require simplesamlphp/simplesamlphp
For configuration I need to add saml-autoconfig.php file at my SIMPLESAMLPHP library root.But my vendor folder is in .gitignore file.
When I update my composer #production whole configuration with saml-autoconfig.php file gets missing.
I need to configured it when my composer get update.
If anyone have idea.Please help
I need to add following file with configuration
1) In saml-autoconfig.php .
$metadata_url_for = array(
/* WARNING WARNING WARNING
* You MUST remove the testing IdP (idp.oktadev.com) from a production system,
* as the testing IdP will allow ANYBODY to log in as ANY USER!
* WARNING WARNING WARNING
* For testing with http://saml.oktadev.com use the line below:
*/
// 'test' => 'http://idp.oktadev.com/metadata',
);
2)vendor/simplesamlphp/config.php
'baseurlpath'=>''
3)vendor/simplesamlphpauthsources.php
'default-sp'=>'' //its default one .I want to add more sp.
How I add dynamically saml-autoconfig.php this file and set my configuration.
If you want to execute a command after composer finished the install/update process, you can use the post-install-cmd and post-update-cmd options.
In this case, assuming that the config folder contains your configuration, you need to add this in your composer.json:
{
"require": {
"simplesamlphp/simplesamlphp": "^1.17"
},
"scripts": {
"post-install-cmd": [
"cp ./config/config.php ./vendor/simplesamlphp/config.php",
"cp ./config/authsources.php ./vendor/simplesamlphp/authsources.php"
],
"post-update-cmd": [
"cp ./config/config.php ./vendor/simplesamlphp/config.php",
"cp ./config/authsources.php ./vendor/simplesamlphp/authsources.php"
]
}
}
I also downloaded the simplesamlphp library, and the path you reported doesn't seem right. The correct path to install the configuration files should be vendor/simplesamlphp/simplesamlphp/config
We have composer as our dependency injection framework which will pull in a library we created, foobar, which works fine. The library foobar has 14 version v1.1.1 -> v1.1.14. All the way up to .12 composer updated the app fine. But now we are getting this error:
Update failed (Source directory /home/username/dev/git/appname/vendor/foorbar/library has unpushed changes on the current branch:
Branch v1.1.14 could not be found on the origin remote and appears to be unpushed)
The composer.json:
{
"name": "App",
"description": "Foo Bar",
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.2.",
"foobarzf2lib/library": "v1.1."
},
"minimum-stability": "stable",
"repositories": [
{
"type": "package",
"package": {
"name": "foobarzf2lib/library",
"version": "v1.1.14",
"source": {
"url": "https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/foobarzf2lib",
"type": "git",
"reference": "test"
},
"autoload": {
"psr-4": {
"FooBar\\" : "FooBar/"
}
}
}
}
]
}
More things to know:
Vendor is ignored in git.
Tried doing $ composer.phar clearcache.
Would be ideal to not have to delete the library every time.
Remove vendor folder and reinstall packages.
Branch v1.1.14 could not be found on the origin remote and appears to be unpushed)
This means that wherever you're pulling the package from does not have a v1.1.14.
Make sure you push v1.1.14 to the package provider and everything should be fine.
Composer treats the local repository (the one inside the vendor folder) as leading. Whenever composer thinks it is not connected any longer (or diverged) for the checkout in place, it refuses to update (which I think is good and sane).
This may seem cumbersome but that is perhaps the price to pay for the ease of use. Composer is actually managing that git checkout while taking care of updates (it has various remotes configured and then a cache, all without additional setup).
In my case I can see similar errors (not the exact error message as asked about, I get a notification one or some files were changed without any direct changes when the remote did change non-fast-forward) and I resolved it the following way (perhaps it works in case of a missing branch, too? Nevertheless reviewing the issue with a git command similar to the following might shed better insights):
git -C <path> pull && composer update
Could work then, where <path> is the directory path given in composers' error message. If it does not, a more specific error message from git hopefully says more.
Point in case is that you need to resolve the version conflict before composer continues. That is similar when you have a merge conflict in git, you can't do the next commit without resolving it as otherwise you'd have files in the repository with merge conflict markers (and won't compile).
In case of interest, one aspect of my git configuration is pull.rebase=merges. That is in principle to do a rebase on pull (IIRC perhaps preserving some merges).
As an alternative - and similar to removing the whole vendor folder - removing just the reported path should work. As this is git, that repository is gone and as composer was concerned of it, it is not any longer:
rm -rf -- <path> && composer update
where <path> is (must be) the path in the composer error message. Take care with rm -rf, it can be easily over-reaching - just fyi.
(this is similar to the reported resolution in composers issue tracker)
Ok, newbie at Laravel. I used composer to download laravel. It created a directory structure like...
vendor\laravel\laravel\app
vendor\laravel\laravel\bootstrap
vendor\laravel\laravel\public
vendor\laravel\framework\....
vendor\laravel\laravel\composer.json
along with many other vendor and laravel directories.
and where my initial composer.json file was in the root directory.
I moved the contents of the vendor\laravel\laravel directory to the top level so that I have a directory structure like...
app\...
bootstrap\...
public\...
vendor\laravel\framework\...
composer.json
vendor\ many other directories...
I updated the index.php directory so that it referred to the new locations of the bootstrap\autoload.php and bootstrap\start.php directories.
I can load the index.php and I get the Laravel image map signifying that all is working.
So, now I go and modify the routes.php to be...
Route::controller('home', 'HomeController');
and try to load the home directory. I get the error...
"include(D:\dev\wamp\www\ltest3\vendor/laravel/laravel/app/controllers/BaseController.php): failed to open stream: No such file or directory"
The problem is that the vendor\composer\autoload_classmap.php still has the old laravel\app controller mappings. e.g.
return array(
'BaseController' => $vendorDir . '/laravel/laravel/app/controllers/BaseController.php',
'DatabaseSeeder' => $vendorDir . '/laravel/laravel/app/database/seeds/DatabaseSeeder.php',
'HomeController' => $vendorDir . '/laravel/laravel/app/controllers/HomeController.php',
instead of the new location at /app/controllers/
If I try to run composer update on the composer.json in my root directory, I get error after awhile of processing...
Failed to execute git status --porcelain --untracked-files=no
So, not sure how to get composer to update the autoload classmap to use my new directory location.
Do people normally leave the vendor\laravel\laravel directory in is original location?
Seems that the composer will probably attempt to update the laravel directory again, but not sure since I get the error.
Here is my full composer.json in the root directory. This was the one that was originally in the vendor\laravel\laravel directory and created by other initial composer run, maybe that is problem.
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.1.*"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "stable"
}
All vendor files whether they belong to Laravel or third party should be in the same location /vendor. This is not just a amtter of mapping in bootstrap but this is important for when you need to update any package in composer. You might need to do this on a delicate environment so why not keep it as it should be? Is there a reason?
Composer is used on many other frameworks and I believe that in all of them you need a vendor directory.
Got it working, thanks to Cryode and user2094178 pointing out that my directory structure was not correct to start off with. I am going to go over several of the issues that I ran into, hopefully helping others that may have the same problem. fyi, this is on Windows 7 running WAMP.
I think where things all went wrong was that I tried to install Laravael by creating a composer.json file with a require of laravel. When running composer, it didn't know that I wanted Laravel as my main project framework, so it just installed all of Laravel down in the vendor directory. There were no top-level app, bootstrap, public, etc. directories.
Scrapped this install and started off from scratch using the directions specified at http://geekanddummy.com/how-to-laravel-4-tutorial-part-1-installation/ (e.g. ran composer create-project laravel/laravel). Ran into the following issues...
1) composer/git complains about https issues. composer continued with warnings on every download but continued to download files using http. When it got to symfphony filesystem.git, it got a fatal error
Failed to clone git#github.com:symfony/Filesystem.git via git, https, ssh protocols, aborting
To resolve this I ran a small php script that output phpinfo(). Determined the location of my php.ini file and removed the comment for "extension=php_openssl.dll". I had already done this for WAMP and Apache, but found out PHP at the command line was using a different php.ini
2) Did a test of git and ssl using "ssh git#github.com" at the command line. Had an issue that it could not authenticate, permission denied. Added environment variable HOME, set it to ..
set HOME=%HOMEPATH%
After this, ssh worked and added an ssh key successfully for github.
3) Deleted the entire project directory and started back from scratch, did not see a way to recover and continue. Next issue was that I got a git error "exceeded the timeout of 300 seconds" when retrieving symfony/Filesystem.git. Fixed this by adding the following composer environment variable..
set COMPOSER_PROCESS_TIMEOUT=2000
4) Deleted entire project and started again from scratch. All was downloaded fine this time. I have the top level app, bootstrap, public, and vendor directories. Loading the laravel\public\index.php works, I see the "You have arrived" page.
I've installed both Composer and Phing via PHPStorm and its capability to run these tools via their .phar-file distribution. So both tools are running "within" their .phar-file.
I created a build.xml and tried to run it within PHPStorm which fails like:
/usr/bin/php /Users/.../dev/phing/phing-latest.phar -f /Users/.../branches/dev/build/build.xml -Dversion=...
Buildfile: /Users/.../branches/dev/build/build.xml
BUILD FAILED
Error reading project file [wrapped: You must have installed the PEAR Archive_Tar class in order to use TarTask.]
Total time: 0.0808 seconds
[PHP Error] include_once(Archive/Tar.php): failed to open stream: No such file or directory [line 75 of phar:///Users/.../dev/phing/phing-latest. phar/classes/phing/tasks/ext/TarTask.php]
[PHP Error] include_once(): Failed opening 'Archive/Tar.php' for inclusion (include_path='phar:///Users/.../dev/phing/phing-latest.phar/bin/.. /classes:.:') [line 75 of phar:///Users/.../dev/phing/phing-latest.phar/classes/phing/tasks/ext/TarTask.php]
I installed the required components via composer:
{
"repositories": [
{
"type": "pear",
"url": "http://pear.php.net"
}
],
"require": {
"phing/phing" : "2.*",
"pear-pear.php.net/pear": "*"
}
}
Basically it's pretty clear what's wrong here, but I'm curious what's the best way out of it. I'm looking for a way out of it, without running into too much further dependencies. The way described above has the charm of being easily adapted to other workstations and other deployment environments. So what I'm looking for is a way to make this work without further environment setup.
Is there a way to influence the include_path in this scenario? I already tried to put the appropriate directories in the PHPStorm PHP Settings but it doesn't seem to be interpreted while staring a build target in the "Phing Build"-Window.