pear/HTTP_Request2

HTTP_Request2 not added to composer include_paths.php and thus unusable by HTTP_OAuth

sudofox opened this issue · 4 comments

I'm trying to use HTTP_Request2 via composer, but found that it's not being added to the composer include_paths.php when installed.

It looks like all that's needed to fix this is to add the following to the package's composer.json:

    "include-path": [
        "./"
    ],

I tested with composer on a fork and adding this fixes the issue and lets me use pear libraries (or anything else) that uses HTTP_Request2.

A workaround seems to be to add this to the global composer.json:

    "include-path": [
        "./vendor/pear/http_request2/"
    ]

it's kinda yucky though.

See the pinned issue #18

The package tries to follow "composer way" when installed with composer (rely on autoloading) and PEAR way when installed with pear (explicit require_once assuming correct include_path setup).

Basically packages using HTTP_Request2 should not unconditionally do

require_once 'HTTP/Request2.php';

if compatibility with PEAR installation is desired then a conditional include should be done

if (!class_exists('HTTP_Request2', true)) {
    require_once 'HTTP/Request2.php';
}

Please open an issue / PR for the package using HTTP_Request2 and propose the above changes. Thanks!

Unfortunately I can't open an issue on pear/HTTP_OAuth as the issues section is disabled.

Furthermore, the issue you referenced, in which xml_rpc2 was broken, doesn't seem to have actually reached resolution as the PR was never accepted for that package. Is the final PR still a good reference for the 'correct' way to do it (despite being unmerged) such that I should submit a similar one for HTTP_OAuth, or should different changes be made?

Yes, that PR is a good reference. As for why it wasn't merged --- most probably no one is actively maintaining XML_RPC2. That being said, https://github.com/pear/HTTP_OAuth doesn't look terribly active, either.

Yes, that PR is a good reference. As for why it wasn't merged --- most probably no one is actively maintaining XML_RPC2. That being said, https://github.com/pear/HTTP_OAuth doesn't look terribly active, either.

I'll make the PR soon, since I'm developing integrations for a service that uses OAuth 1.0 still