Comments (10)
Hi!
I saw reference to Ubuntu 16.04 in the rackspace/php-opencloud issue regarding PHP7.0 and am actually the individual working on moving PHP7.0 to main in Ubuntu 16.04 (and dropping PHP5 support).
To that end, I hit a bit of an issue now that the version of php-opencloude currently in the 16.04 archive (1.16.0) depends on guzzle/guzzle, which I'd like to remove altogether from the repository (it's EOL and deprecated, as you and others have noted elsewhere). What kind of schedule does 2.0.0 currently have? Would it be reasonable for us to package 2.0.0-rc1 in Ubuntu?
from openstack.
@nacc I'm pretty happy with the status of 2.0.0-rc1. It supports all of the CORE OpenStack services and has full API declarations, unit tests, sample files, reference docs, user docs and integration tests. I wanted to wait awhile for user feedback before launching a full 2.0.0 release. So this could take another month or two. Before the full release I'd need to do some refactoring (including adding PHP 7 functionality).
If we package 2.0.0-rc1 into 16.04 now, how easy would it be to roll out 2.0.0 when it's fully ready?
from openstack.
I'm not sure on that question, but I'll link to this issue from our LP bug and be sure to update once I have a clear answer on it. If the changes are bugfixes, I think it'll be not too big of a deal to update. Just no new features without exception being granted.
from openstack.
@jamiehannaford started working on packaging and proposing 2.0.0-RC2 for 16.04.
Ran into some issues, which I can figure out, but noticed you're using https://github.com/phpspec/prophecy-phpunit which is deprecated and not available in Ubuntu. Can you update the src to use phpunit proper?
from openstack.
@nacc I've just cut a new RC release, including the fix which you mentioned. I want to release v2.0.0 proper next week, which will include:
- a new dependency on
php-opencloud/common
that contains common helper classes, ensuring that the Rackspace provider doesn't couple to OpenStack unnecessarily - PHP 7 support, including return types etc.
For now though, I think you're good to package RC 3 into 16.04
from openstack.
@jamiehannaford Thanks! working on it now. Is there a reason for a reorg from rackspace/php-openstack that had lib/ and lib/OpenCloud but now doesn't?
Also, the old version had a changelog in docs/, is that intentionally not present right now? I guess for a "first" release, it may not matter :)
from openstack.
I'm getting a few unit-test failures (note I have to use current HEAD not 2.0.0-RC3 due to the testcases being broken in that tag).
PHPUnit 5.1.3 by Sebastian Bergmann and contributors.
..............E.....E.......................................... 63 / 333 ( 18%)
..................EE........................................... 126 / 333 ( 37%)
............................................................... 189 / 333 ( 56%)
............................................................... 252 / 333 ( 75%)
............................................................... 315 / 333 ( 94%)
.................. 333 / 333 (100%)
Time: 416 ms, Memory: 16.00Mb
There were 4 errors:
1) unit\BlockStorage\v2\ServiceTest::test_it_lists_volumes
InvalidArgumentException: Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, malformed JSON
/build/php-opencloud-vZ1fuW/php-opencloud-2.0.0~rc3+gitcd025451/src/Common/Transport/Utils.php:25
/build/php-opencloud-vZ1fuW/php-opencloud-2.0.0~rc3+gitcd025451/src/Common/Resource/Iterator.php:47
/build/php-opencloud-vZ1fuW/php-opencloud-2.0.0~rc3+gitcd025451/src/Common/Resource/Iterator.php:85
/build/php-opencloud-vZ1fuW/php-opencloud-2.0.0~rc3+gitcd025451/tests/unit/BlockStorage/v2/ServiceTest.php:80
2) unit\BlockStorage\v2\ServiceTest::test_it_lists_snapshots
InvalidArgumentException: Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, malformed JSON
/build/php-opencloud-vZ1fuW/php-opencloud-2.0.0~rc3+gitcd025451/src/Common/Transport/Utils.php:25
/build/php-opencloud-vZ1fuW/php-opencloud-2.0.0~rc3+gitcd025451/src/Common/Resource/Iterator.php:47
/build/php-opencloud-vZ1fuW/php-opencloud-2.0.0~rc3+gitcd025451/src/Common/Resource/Iterator.php:85
/build/php-opencloud-vZ1fuW/php-opencloud-2.0.0~rc3+gitcd025451/tests/unit/BlockStorage/v2/ServiceTest.php:167
3) OpenStack\Test\Common\Resource\AbstractResourceTest::test_it_executes_operations_until_a_204_is_received
InvalidArgumentException: Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, malformed JSON
/build/php-opencloud-vZ1fuW/php-opencloud-2.0.0~rc3+gitcd025451/src/Common/Transport/Utils.php:25
/build/php-opencloud-vZ1fuW/php-opencloud-2.0.0~rc3+gitcd025451/src/Common/Resource/Iterator.php:47
/build/php-opencloud-vZ1fuW/php-opencloud-2.0.0~rc3+gitcd025451/src/Common/Resource/Iterator.php:85
/build/php-opencloud-vZ1fuW/php-opencloud-2.0.0~rc3+gitcd025451/tests/unit/Common/Resource/AbstractResourceTest.php:87
4) OpenStack\Test\Common\Resource\AbstractResourceTest::test_it_invokes_function_if_provided
InvalidArgumentException: Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, malformed JSON
/build/php-opencloud-vZ1fuW/php-opencloud-2.0.0~rc3+gitcd025451/src/Common/Transport/Utils.php:25
/build/php-opencloud-vZ1fuW/php-opencloud-2.0.0~rc3+gitcd025451/src/Common/Resource/Iterator.php:47
/build/php-opencloud-vZ1fuW/php-opencloud-2.0.0~rc3+gitcd025451/src/Common/Resource/Iterator.php:85
/build/php-opencloud-vZ1fuW/php-opencloud-2.0.0~rc3+gitcd025451/tests/unit/Common/Resource/AbstractResourceTest.php:115
FAILURES!
Tests: 333, Assertions: 763, Errors: 4.
This is with
php --version
PHP 7.0.3-9ubuntu1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
from openstack.
http://php.net/manual/en/function.json-last-error.php
ah i think one of the comments explains it:
when json_decode a empty string, PHP7 will trigger an Syntax error:
<?php
json_decode("");
var_dump(json_last_error(), json_last_error_msg());
// PHP 7
int(4)
string(12) "Syntax error"
// PHP 5
int(0)
string(8) "No error"
And officially documented at: php/php-src@9d037d5
from openstack.
Something like:
diff --git a/src/Common/Transport/Utils.php b/src/Common/Transport/Utils.php
index c7797be..f85d9bc 100644
--- a/src/Common/Transport/Utils.php
+++ b/src/Common/Transport/Utils.php
@@ -18,7 +18,11 @@ class Utils
JSON_ERROR_UTF8 => 'JSON_ERROR_UTF8 - Malformed UTF-8 characters, possibly incorrectly encoded'
];
- $data = json_decode((string) $response->getBody(), $assoc);
+ $responseBody = (string) $response->getBody();
+ if (strlen($responseBody) == 0) {
+ return $responseBody;
+ }
+ $data = json_decode($responseBody, $assoc);
if (JSON_ERROR_NONE !== json_last_error()) {
$last = json_last_error();
Need a PR?
from openstack.
@nacc Yes please, that would be great. The only thing I would change is line breaks before and after the if
block. Plus ===
instead of ==
. Thanks!
from openstack.
Related Issues (20)
- Support object_storage_url override
- Documentation bug for createVolume method
- Documentation bug for security groups HOT 1
- How to retrieve a part of an object by defining a range? HOT 1
- How to get used_ips of network
- ENH REQUEST: Return image ID when creating server image
- ENH REQUEST: Filter Image List HOT 1
- DOCS: Delete Image docs are incorrect or missing information.
- Is this code still being maintained? HOT 13
- failed: Call to undefined function GuzzleHttp\Promise\all()
- The current state of the project HOT 1
- The createLargeObject() does not work correctly for segment count 10 and more
- How to get a public URL using which I can view image in browser? HOT 2
- $compute->getServer return null values HOT 3
- question: can we suspend and un-suspend server? HOT 1
- used password shown on error message HOT 1
- getVolumesAttached to server HOT 2
- [Question, potentially a bug] How to debug requests when creating a server HOT 3
- Example or sample how to use Gnocchi HOT 1
- 401 UNAUTHORIZED HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openstack.