Skip to content

Revert https://github.com/bigcommerce/bigcommerce-api-php/pull/155 #174

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

Merged
merged 1 commit into from
Jun 15, 2016

Conversation

bc-ruth
Copy link
Contributor

@bc-ruth bc-ruth commented Jun 10, 2016

…e away, resetting to default

@aleachjr @PascalZajac

What:
Reverting #155
and optionally define STDIN to address issues mentioned in same PR ^

Why:
Breaking basic tests
curl_exec(): CURLOPT_INFILE resource has gone away, resetting to default
FAILURES!
Tests: 70, Assertions: 476, Errors: 12.

Testing:
................................................................. 65 / 70 ( 92%)
.....
OK (70 tests, 541 assertions)

@coveralls
Copy link

coveralls commented Jun 10, 2016

Coverage Status

Coverage decreased (-0.9%) to 64.717% when pulling 6f164a5 on bc-ruth:OMNI-1167 into 345d27d on bigcommerce:master.

@coveralls
Copy link

coveralls commented Jun 10, 2016

Coverage Status

Coverage decreased (-1.1%) to 64.466% when pulling 40c0972 on bc-ruth:OMNI-1167 into 345d27d on bigcommerce:master.

@lord2800
Copy link
Contributor

I'm... not sure if this is the correct way to fix this. It needs some more investigation I think.

@coveralls
Copy link

coveralls commented Jun 10, 2016

Coverage Status

Coverage decreased (-0.4%) to 65.226% when pulling f773ef5 on bc-ruth:OMNI-1167 into 345d27d on bigcommerce:master.

@bc-ruth bc-ruth changed the title OMNI-1167 Attempt to fix curl_exec(): CURLOPT_INFILE resource has gon… OMNI-1167 Fix curl_exec(): CURLOPT_INFILE resource has gon… Jun 12, 2016
@coveralls
Copy link

coveralls commented Jun 12, 2016

Coverage Status

Coverage decreased (-0.3%) to 65.294% when pulling 407a278 on bc-ruth:OMNI-1167 into 345d27d on bigcommerce:master.

@bc-ruth bc-ruth changed the title OMNI-1167 Fix curl_exec(): CURLOPT_INFILE resource has gon… Revert https://github.com/bigcommerce/bigcommerce-api-php/pull/155 Jun 12, 2016
@PascalZajac
Copy link
Contributor

This isn't a straight revert though; you're adding new behaviour for every request by changing the flag after the connection is closed (which tbh I don't understand anyway).

I'm also confused why the tests would pass on the original PR, I guess we don't have the flag to treat warnings as errors?

@@ -91,6 +91,9 @@ class Connection
*/
public function __construct()
{
if (!defined('STDIN')) {
define('STDIN', fopen('php://stdin', 'r'));
}
$this->curl = curl_init();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PascalZajac I can remove this change to make this PR a proper revert.
I was hoping to resolve the issue(s) reported in #139

@bc-ruth
Copy link
Contributor Author

bc-ruth commented Jun 12, 2016

@PascalZajac the tests were not passing on the original PR. The regression wasn't caught by our basic tests then because we updated the bigcommerce-api-php repo but did not push/bump a new version in bcapp.

@aleachjr
Copy link
Contributor

The thing to keep in mind here is that this is the public API and its test suite was passing. We use this in functional testing but our first priority should be to stabilize it for the public use.

@PascalZajac
Copy link
Contributor

I understand now, thank you for clarifing @bc-ruth. In that case, I'm happy for us to accept Ruth's PR, since it does seem to be the "accepted" way to define the constant when not running in CLI mode.

@bc-ruth
Copy link
Contributor Author

bc-ruth commented Jun 13, 2016

@Lewiscowles1986 can you pull this branch and verify that this fixes your issue in #155 ?

@Lewiscowles1986
Copy link
Contributor

Lewiscowles1986 commented Jun 13, 2016

Hi all.

I'm not encountering any breakage in test suites; would it be possible to let me know what is wrong? I've read, but I'm not sure I get it.

I've just run

git clone https://github.com/bigcommerce/bigcommerce-api-php
cd bigcommerce-api-php
composer install
phpunit

here is the output

lewis@lewis-HP-ENVY-17-Notebook-PC:~/projects/php$ git clone https://github.com/bigcommerce/bigcommerce-api-php
Cloning into 'bigcommerce-api-php'...
remote: Counting objects: 1543, done.
remote: Total 1543 (delta 0), reused 0 (delta 0), pack-reused 1543
Receiving objects: 100% (1543/1543), 422.07 KiB | 226.00 KiB/s, done.
Resolving deltas: 100% (702/702), done.
Checking connectivity... done.
lewis@lewis-HP-ENVY-17-Notebook-PC:~/projects/php$ cd bigcommerce-api-php/
lewis@lewis-HP-ENVY-17-Notebook-PC:~/projects/php/bigcommerce-api-php$ ls
composer.json  LICENSE  phpunit.xml.dist  README.md  src  test
lewis@lewis-HP-ENVY-17-Notebook-PC:~/projects/php/bigcommerce-api-php$ composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing symfony/yaml (v2.8.7)
    Downloading: 100%         

  - Installing symfony/stopwatch (v3.1.0)
    Downloading: 100%         

  - Installing symfony/polyfill-mbstring (v1.2.0)
    Loading from cache

  - Installing symfony/console (v3.1.0)
    Downloading: 100%         

  - Installing symfony/filesystem (v3.1.0)
    Downloading: 100%         

  - Installing symfony/config (v3.1.0)
    Downloading: 100%         

  - Installing psr/log (1.0.0)
    Loading from cache

  - Installing symfony/event-dispatcher (v2.8.7)
    Downloading: 100%         

  - Installing guzzle/guzzle (v3.9.3)
    Downloading: 100%         

  - Installing satooshi/php-coveralls (v1.0.0)
    Downloading: 100%         

  - Installing codeless/logmore (v0.9.0)
    Downloading: 100%         

  - Installing nikic/php-parser (v2.1.0)
    Loading from cache

  - Installing codeless/jugglecode (v1.0.0)
    Downloading: 100%         

  - Installing sebastian/version (1.0.6)
    Loading from cache

  - Installing sebastian/global-state (1.1.1)
    Loading from cache

  - Installing sebastian/recursion-context (1.0.2)
    Loading from cache

  - Installing sebastian/exporter (1.2.1)
    Loading from cache

  - Installing sebastian/environment (1.3.7)
    Loading from cache

  - Installing sebastian/diff (1.4.1)
    Loading from cache

  - Installing sebastian/comparator (1.2.0)
    Loading from cache

  - Installing doctrine/instantiator (1.0.5)
    Loading from cache

  - Installing webmozart/assert (1.0.2)
    Downloading: 100%         

  - Installing phpdocumentor/reflection-common (1.0)
    Downloading: 100%         

  - Installing phpdocumentor/type-resolver (0.2)
    Downloading: 100%         

  - Installing phpdocumentor/reflection-docblock (3.1.0)
    Downloading: 100%         

  - Installing phpspec/prophecy (v1.6.1)
    Downloading: 100%         

  - Installing phpunit/php-text-template (1.2.1)
    Loading from cache

  - Installing phpunit/phpunit-mock-objects (2.3.8)
    Loading from cache

  - Installing phpunit/php-timer (1.0.8)
    Loading from cache

  - Installing phpunit/php-token-stream (1.4.8)
    Loading from cache

  - Installing phpunit/php-file-iterator (1.3.4)
    Downloading: 100%         

  - Installing phpunit/php-code-coverage (2.2.4)
    Loading from cache

  - Installing phpunit/phpunit (4.5.1)
    Downloading: 100%         

symfony/console suggests installing symfony/process ()
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/event-dispatcher suggests installing symfony/http-kernel ()
guzzle/guzzle suggests installing guzzlehttp/guzzle (Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated.)
satooshi/php-coveralls suggests installing symfony/http-kernel (Allows Symfony integration)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.1)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
Writing lock file
Generating autoload files
lewis@lewis-HP-ENVY-17-Notebook-PC:~/projects/php/bigcommerce-api-php$ phpunit
PHPUnit 5.3.0 by Sebastian Bergmann and contributors.

Error:         No code coverage driver is available

...............................................................  63 / 199 ( 31%)
............................................................... 126 / 199 ( 63%)
............................................................... 189 / 199 ( 94%)
..........                                                      199 / 199 (100%)

Time: 559 ms, Memory: 10.00Mb

OK (199 tests, 352 assertions)
lewis@lewis-HP-ENVY-17-Notebook-PC:~/projects/php/bigcommerce-api-php$ 

image

Need to know if I have actually broken something or if what you mean is this breaks a third-party system somewhere down the line (i.e. it's a deck of cards where some third-party internal tools require this to work)

@bc-ruth
Copy link
Contributor Author

bc-ruth commented Jun 13, 2016

Thanks @Lewiscowles1986

The original issue is described in #139

We tried to fix the issue above by removing a line in Connection.php (#155)
While this fix solved the public's use of the API, it broke our internal use of the API.

So we would like to revert #155 but also need to fix the original issue in #139 another way, a fix that would work for both public and internal use.

@Lewiscowles1986
Copy link
Contributor

Lewiscowles1986 commented Jun 13, 2016

I've not tested @bc-ruth code in any live projects but it seems to fulfil all needs; I just downloaded and all tests pass (there did seem to be less tests and assertions)

To be clear I don't think I ever had an issue with #139; I just noticed the issue and was put a bit out of joint by the advice to edit the API files directly (seemed like an easy PR) 😉

👍 for this to be merged. I Understand now

@aleachjr aleachjr merged commit 37087f7 into bigcommerce:master Jun 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants