How to use Mezzio -> Session - session

I add session and session-ext packages to a Mezzio project.
After that I get an error:
Too few arguments to function Mezzio\Session\SessionMiddleware::__construct(), 0 passed in /var/www/mezzio/vendor/mezzio/mezzio/src/MiddlewareContainer.php on line 57 and exactly 1 expected
I find that mezzio-session uses Zend-session and try to install Zend-session but this gives me an error too:
mezzio/mezzio-session-ext is locked to version 1.12.0 and an update of this package was not requested.
mezzio/mezzio-session 1.6.0 conflicts with zendframework/zend-expressive-session 1.3.0.
mezzio/mezzio-session-ext 1.12.0 requires mezzio/mezzio-session ^1.4 -> satisfiable by mezzio/mezzio-session[1.6.0].
Root composer.json requires zendframework/zend-expressive-session ^1.3 -> satisfiable by zendframework/zend-expressive-session[1.3.0].
How can I use mezzio-session and -session-ext in a Mezzio project?
Update 1:
I get this error on a route where I have used SessionMiddleware::class in the route pipeline as described here:
use Mezzio\Authentication\OAuth2;
use Mezzio\Session\SessionMiddleware;
$app->route('/oauth2/authorize', [
SessionMiddleware::class,
OAuth2\AuthorizationMiddleware::class,
// The following middleware is provided by your application (see below):
App\OAuthAuthorizationMiddleware::class,
OAuth2\AuthorizationHandler::class
], ['GET', 'POST']);

Related

compose update not working if using php8 (xxx in the lock file but not in remote repositories ,...)

I've a composer project (magento 2, upgraded from php7 to php 8), if now i use php 8 (inside docker) run "composer udpate", it will shows
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires mobiledetect/mobiledetectlib 2.8.39, found mobiledetect/mobiledetectlib[2.8.39] in the lock file but not in remote repositories, mak e sure you avoid updating this package to keep the one from the lock file.
Problem 2
- Root composer.json requires magento/composer-root-update-plugin 2.0.2 -> satisfiable by magento/composer-root-update-plugin[2.0.2].
- magento/composer-root-update-plugin 2.0.2 requires composer/composer ^1.0 || ^2.0 -> found composer/composer[2.2.18] in the lock file but not in remote reposito ries, make sure you avoid updating this package to keep the one from the lock file.
Problem 3
- Root composer.json requires magento/ece-tools ^2002.1.11 -> satisfiable by magento/ece-tools[2002.1.11, 2002.1.12].
- magento/ece-tools[2002.1.11, ..., 2002.1.12] require colinmollenhour/credis ^1.6.0 -> found colinmollenhour/credis[v1.13.0] in the lock file but not in remote r epositories, make sure you avoid updating this package to keep the one from the lock file.
Problem 4
- Root composer.json requires magento/magento-cloud-metapackage >=2.4.5 <2.4.6 -> satisfiable by magento/magento-cloud-metapackage[2.4.5].
- magento/magento-cloud-metapackage 2.4.5 requires fastly/magento2 ^1.2.34 -> found fastly/magento2[1.2.187] in the lock file but not in remote repositories, make sure you avoid updating this package to keep the one from the lock file.
But it will work fine in php7.4(inside docker), do anyone know what's the problem?
More info:
docker info
php72:
container_name: web_php
image: webmaketech/php74
build: ./php72
volumes:
- ./src:/var/www
- ./php72/php.ini:/usr/local/etc/php/php.ini
- ./php72/php-fpm.conf:/usr/local/etc/php-fpm.d/www.conf
php810:
container_name: web_php_810
image: webmaketech/php810
build: ./php810
volumes:
- ./src:/var/www
- ./php810/php.ini:/usr/local/etc/php/php.ini
- ./php810/php-fpm.conf:/usr/local/etc/php-fpm.d/www.conf
You can ignore platform requirements. run the below command.
composer udpate --ignore-platform-reqs
searched 2 days on internet, finally got solution
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer
after run this command, i can process now

Define setup.py dependencies from a private PyPI

I'd like to install dependencies from my private PyPI by specifying them within a setup.py.
I've already tried to specify where to find dependencies within the dependency_links this way:
setup(
...
install_requires=["foo==1.0"],
dependency_links=["https://my.private.pypi/"],
...
)
I've also tried to define the entire URL within the dependency_links:
setup(
...
install_requires=[],
dependency_links=["https://my.private.pypi/foo/foo-1.0.tar.gz"],
...
)
but when I try to install with python setup.py install, neither of them worked for me.
Can anybody help me?
EDITS:
With the first piece of code I got this error:
...
Installed .../test-1.0.0-py3.7.egg
Processing dependencies for test==1.0.0
Searching for foo==1.0
Reading https://my.private.pypi/
Reading https://pypi.org/simple/foo/
Couldn't find index page for 'foo' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.org/simple/
No local packages or working download links found for foo==1.0
error: Could not find suitable distribution for Requirement.parse('foo==1.0')
while in the second case I didn't get any error, just the following:
...
Installed .../test-1.0.0-py3.7.egg
Processing dependencies for test==1.0.0
Finished processing dependencies for test==1.0.0
UPDATE 1:
I've tried to change the setup.py following sinoroc's instructions. Now my setup.py looks like this:
setup(
...
install_requires=["foo==1.0"],
dependency_links=["https://username:password#my.private.pypi/folder/foo/foo-1.0.tar.gz"],
...
)
I built the library test with python setup.py sdist and tried to install it with pip install /tmp/test/dist/test-1.0.0.tar.gz, but I still get this error:
Processing /tmp/test/dist/test-1.0.0.tar.gz
ERROR: Could not find a version that satisfies the requirement foo==1.0 (from test==1.0.0) (from versions: none)
ERROR: No matching distribution found for foo==1.0 (from test==1.0.0)
Regarding the private PyPi, I don't have any additional information because I'm not the administrator of it. As you can see, I just have the credentials (username and password) for that server.
Additionally, that PyPi is organised in sub-folders, https://my.private.pypi/folder/.. where the dependency I want to install is.
UPDATE 2:
By running pip install --verbose /tmp/test/dist/test-1.0.0.tar.gz, it seams there is only 1 location where to search for the library foo, in the public server https://pypi.org/simple/foo/ and not in our private server https://my.private.pypi/folder/foo/.
Here the output:
...
1 location(s) to search for versions of foo:
* https://pypi.org/simple/foo/
Getting page https://pypi.org/simple/foo/
Found index url https://pypi.org/simple
Looking up "https://pypi.org/simple/foo/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/foo/ HTTP/1.1" 404 13
Status code 404 not in (200, 203, 300, 301)
Could not fetch URL https://pypi.org/simple/foo/: 404 Client Error: Not Found for url: https://pypi.org/simple/foo/ - skipping
Given no hashes to check 0 links for project 'foo': discarding no candidates
ERROR: Could not find a version that satisfies the requirement foo==1.0 (from test==1.0.0) (from versions: none)
Cleaning up...
Removing source in /private/var/...
Removed build tracker '/private/var/...'
ERROR: No matching distribution found for foo==1.0 (from test==1.0.0)
Exception information:
Traceback (most recent call last):
...
In your second attempt, I believe you should still have foo==1.0 in the install_requires.
Update
Be aware that pip does not support dependency_links (it used to, but does not anymore).
For pip, the alternative is to use command line options such as --index-url, --extra-index-url, or --find-links. These options can not be enforced on the user of your project (contrary to the dependency links from setuptools), so they have to be properly documented. To facilitate this, a good idea is to provide an example of a requirements.txt file to the users of your project. This file can contain some of pip options.
For example:
# requirements.txt
# ...
--find-links 'https://my.private.pypi/'
foo==1.0
# ...

Composer GOS Websocket bundle symfony 2.8 dependency trouble / Exception

Hi i want to use gos websocket bundle but keep getting this error
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\UndefinedMethodException:
Attempted to call an undefined method named "setArgument" of class
"Symfony\Component\DependencyInjection\Definition".
Did you mean to call e.g. "addArgument", "getArgument", "getArguments"
or "setArguments"? in /var/www/vhosts/foo/vendor/gos/web-
socket-bundle/DependencyInjection/CompilerPass/PingableDriverCompilerPass.php:37
so it seems the interface is not compatible with symfony 2.8 ? Here are the versions installed with composer
gos/pnctl-event-loop-emitter v0.1.7
gos/pubsub-router-bundle v0.3.4
gos/web-socket-bundle v1.8.13
gos/websocket-client v0.1.2
symfony/symfony v2.8.11
anybody any idea what is the problem and what i can do from here idea?
I am using Thruway library for websockets in my project running on PHP 5.4 (works well with PHP 7 too). if you are in early stage of setting up websocket in your project I would recommend you to switch to Thruway, which has clear documentation and support.

Magento Upgrade 1.3 1.4 Pear Error Invalid Argument foreach

Hello I am trying to upgrade Magento 1.3 to 1.4. using this guide http://astrio.net/blog/magento-upgrade-guide/
I tried the command ./pear upgrade -f magento-core/Mage_All_Latest-stable
I got the error
Notice: Array to string conversion in PEAR/REST/10.php on line 85
PHP Notice: Array to string conversion in /home/www/sss/staging.mysite.net/public/downloader/pearlib/php/PEAR/REST/10.php on line 85
So I tried Magento upgrade PEAR error ( specifically this command ./pear channel-update connect.magentocommerce.com/core ) .. but that gives me the error:
Updating channel "connect.magentocommerce.com/core"
Channel "connect.magentocommerce.com/core" is not responding over http://, failed with message: File http://connect.magentocommerce.com:80/core/channel.xml not valid (received: HTTP/1.1 404 Not Found
)
Trying channel "connect.magentocommerce.com/core" over https:// instead
Cannot retrieve channel.xml for channel "connect.magentocommerce.com/core" (File https://connect.magentocommerce.com:443/core/channel.xml not valid (received: HTTP/1.1 404 Not Found
))
Ideas?
You waited a bit too long to upgrade if you want to use Magento Connect to do it.
In order to upgrade 1.4 to a later version using Magento Connect requires you to upgrade to the 1.5 PEAR Connect package which switches from using ./pear to ./mage. There is no equivalent to doing this upgrade for 1.3 to use Connect to upgrade to 1.4.
You will need to manually download and apply the Magento 1.4 upgrade by downloading the full package from the Magento CE Download page under the Release Archives for the version of 1.4 you wish to upgrade to.
Of course, test it hard on a staging server as you will find that there will be template issues, database upgrade issues, etc.

ESB Build issue from source code

I have downloaded platform source code and trying to build ESB 4.6.0 "by running mvn clean install inside "carbon/platform/tags/4.0.7/patch-releases/4.0.6/"
I am getting following error message -
Installation failed.
Cannot complete the install because one or more required items could not be foun
d.
Software being installed: WSO2 Carbon - Axis2 Transport HTTP Pass-through Featu
re 1.0.2 (org.wso2.carbon.transports.passthru.feature.group 1.0.2)
Missing requirement: WSO2 Carbon - Axis2 Transport HTTP Pass-through Feature 1.
0.2 (org.wso2.carbon.transports.passthru.feature.group 1.0.2) requires 'org.wso2
.carbon.core.server.feature.group [4.1.0,4.2.0)' but it could not be found
Application failed, log file location: C:\Users\user.m2\repository\org\eclipse\
tycho\tycho-p2-runtime\0.13.0\eclipse\configuration\1368415821993.log
Can you comment out following two code segments in pom.xml[1] and continue build using "mvn clean install -Dmaven.test.skip=true -Dproduct=esb" inside "carbon/platform/tags/4.0.7/patch-releases/4.0.6/" . this passthru feature is already included in synapse code. so you can remove it.
#line 178
<featureArtifactDef>org.wso2.carbon:org.wso2.carbon.transports.passthru.feature:${passthru.transport.patch.version}</featureArtifactDef>
#line 512
<feature>
<id>org.wso2.carbon.transports.passthru.feature.group</id>
<version>${passthru.transport.patch.version}</version>
</feature>
[1] https://svn.wso2.org/repos/wso2/carbon/platform/tags/4.0.7/products/esb/4.6.0/modules/p2-profile/pom.xml

Resources