Skip to content
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

Provisioning API broken on PHP 5.4 #18428

Closed
oparoz opened this issue Aug 19, 2015 · 16 comments · Fixed by #18691 or #18744
Closed

Provisioning API broken on PHP 5.4 #18428

oparoz opened this issue Aug 19, 2015 · 16 comments · Fixed by #18691 or #18744

Comments

@oparoz
Copy link
Contributor

oparoz commented Aug 19, 2015

A recent change seems to have broken the provisioning API and it doesn't behave properly any more on PHP 5.4 and 5.5 (probably old) on Travis when trying to create a user and verify its creation.

It works fine on PHP 5.6.

I don't have more details at this point, except that everything was fine last night.

This is what happens when I try to create a user

1) Failed to create a user via the provisioning api in OcsCreateUserCept (tests/api/OcsCreateUserCept.php)
 Step  I see xml response includes "DOMDocument"
 Fail  found in XML Response
Failed asserting that '<ocs><meta><status>failure</status><statuscode>999</statuscode><message>Invalid query, please check the syntax. API specifications are here: http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:
</message></meta><data></data></ocs>' contains "<status>ok</status>".

Checking for the presence of a user still works.

Could someone please confirm that behaviour.

@oparoz
Copy link
Contributor Author

oparoz commented Aug 19, 2015

Maybe this re-merge?
127b6e2

@DeepDiver1975 @Raydiation @MorrisJobke

@MorrisJobke
Copy link
Contributor

@oparoz I tried some GET methods of the OCS API and they worked :(

@MorrisJobke
Copy link
Contributor

@Xenopathic @PVince81

@MorrisJobke
Copy link
Contributor

Ah right. I tried with 5.6 ...sorry

@MorrisJobke MorrisJobke added this to the 8.2-current milestone Aug 19, 2015
@oparoz oparoz added the dev:ocs label Aug 19, 2015
@PVince81
Copy link
Contributor

Argh, not the router thing again?

@DeepDiver1975
Copy link
Member

@oparoz can you bisect this? THX

@RobinMcCorkell
Copy link
Member

This is highly likely to be that php://input bug...

@oparoz
Copy link
Contributor Author

oparoz commented Aug 31, 2015

Sorry guys, #18691 didn't fix it.

 # php vendor/bin/codecept run tests/api/OcsCreateUserCest.php
Codeception PHP Testing Framework v2.1.2
Powered by PHPUnit 4.8.6 by Sebastian Bergmann and contributors.

Api Tests (3) ----------------------------------------------------------------------------------------------------------------
Create a user via the provisioning api (OcsCreateUserCest::createUser)                                                  Fail
Make sure the user exists (OcsCreateUserCest::checkUserExists)                                                          Fail
Delete the user (OcsCreateUserCest::deleteUser)                                                                         Fail
------------------------------------------------------------------------------------------------------------------------------


Time: 4.76 seconds, Memory: 20.00Mb

There were 3 failures:

---------
1) Failed to create a user via the provisioning api in OcsCreateUserCest::createUser (tests/api/OcsCreateUserCest.php)

 Step  I see xml response includes "DOMDocument"
 Fail  found in XML Response
Failed asserting that '<ocs><meta><status>failure</status><statuscode>999</statuscode><message>Invalid query, please check the syntax. API specifications are here: http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:
</message></meta><data></data></ocs>' contains "<status>ok</status>".

Scenario Steps:

 6. $I->seeXmlResponseIncludes("DOMDocument")
 5. $I->seeResponseIsXml()
 4. $I->seeResponseCodeIs(200)
 3. $I->sendPOST("/ocs/v1.php/cloud/users",{"userid":"BlueDragon","password":"testBlueDragon"})
 2. $I->haveHttpHeader("Content-Type","application/x-www-form-urlencoded")
 1. $I->amHttpAuthenticated("admin","admin")


---------
2) Failed to make sure the user exists in OcsCreateUserCest::checkUserExists (tests/api/OcsCreateUserCest.php)

 Step  I see xml response includes "DOMDocument"
 Fail  found in XML Response
Failed asserting that '<ocs><meta><status>failure</status><statuscode>998</statuscode><message>The requested user could not be found</message></meta><data></data></ocs>' contains "<status>ok</status>".

Scenario Steps:

 6. $I->seeXmlResponseIncludes("DOMDocument")
 5. $I->seeResponseIsXml()
 4. $I->seeResponseCodeIs(200)
 3. $I->sendGET("/ocs/v1.php/cloud/users/BlueDragon")
 2. $I->haveHttpHeader("Content-Type","application/x-www-form-urlencoded")
 1. $I->amHttpAuthenticated("admin","admin")


---------
3) Failed to delete the user in OcsCreateUserCest::deleteUser (tests/api/OcsCreateUserCest.php)

 Step  I see xml response includes "DOMDocument"
 Fail  found in XML Response
Failed asserting that '<ocs><meta><status>failure</status><statuscode>101</statuscode><message></message></meta><data></data></ocs>' contains "<status>ok</status>".

Scenario Steps:

 6. $I->seeXmlResponseIncludes("DOMDocument")
 5. $I->seeResponseIsXml()
 4. $I->seeResponseCodeIs(200)
 3. $I->sendDELETE("/ocs/v1.php/cloud/users/BlueDragon")
 2. $I->haveHttpHeader("Content-Type","application/x-www-form-urlencoded")
 1. $I->amHttpAuthenticated("admin","admin")


FAILURES!
Tests: 3, Assertions: 9, Failures: 3.

Test is available here:
https://github.com/owncloud/gallery/blob/master/tests/api/OcsCreateUserCest.php

@oparoz oparoz reopened this Aug 31, 2015
@RobinMcCorkell
Copy link
Member

@oparoz Ah, good thing you have more comprehensive tests. Thanks for sending me the link, I'll try and fix it

@oparoz
Copy link
Contributor Author

oparoz commented Aug 31, 2015

Cool :)

Try to reverse 127b6e2 and see how it goes.
Without it, it works for me

@RobinMcCorkell
Copy link
Member

Hmm, that test works just fine on PHP 5.5.9 (Ubuntu 14.04 Docker). That was with current master.

@RobinMcCorkell
Copy link
Member

However, the commit prior to #18691 also worked... @oparoz what OS and PHP version are you running?

@oparoz
Copy link
Contributor Author

oparoz commented Aug 31, 2015

Travis Ubuntu 12.4 - PHP 5.4
FreeBSD 9 - PHP 5.5.28

One thing I've noticed is that once the test passes, after you've commented out the changes per example, it will pass again, after you re-implement them. Might be a cookie thing. I haven't looked at why yet. I was just surprised it did.

@RobinMcCorkell
Copy link
Member

@oparoz I'm unable to reproduce the error on Ubuntu 12.04 running PHP 5.4.44... even without the Request patch. Everything just works.

@oparoz
Copy link
Contributor Author

oparoz commented Sep 1, 2015

I'm going to create a branch of Gallery with just that test. That way, if it still fails, you'll be able to tell Travis what to do in case you want to debug it on there.

@oparoz
Copy link
Contributor Author

oparoz commented Sep 1, 2015

Here you go:
https://travis-ci.org/owncloud/gallery/builds/78215826

Fails on master with any version of PHP, but still works on 8.1

@lock lock bot locked as resolved and limited conversation to collaborators Aug 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants