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

Backport updates #811

Merged
merged 32 commits into from Nov 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2ee8f9a
Update ca cert
abraham Jan 20, 2019
b79d6c0
Merge pull request #743 from abraham/update-ca-cert
abraham Jan 20, 2019
1a88de4
Switch CI to PHP 7.2 and 7.3
abraham Jan 20, 2019
e870020
Merge pull request #742 from abraham/drop-php-5
abraham Jan 20, 2019
692fca2
Specify PHP 7.2 or 7.3
abraham Jan 21, 2019
f7858f5
Merge pull request #744 from abraham/abraham-patch-1
abraham Jan 21, 2019
ac9a34b
Add downloads badge
abraham Jan 30, 2019
8dd81d4
Merge pull request #752 from abraham/download-badge
abraham Jan 30, 2019
16ea0a3
Update cacert.pem
abraham Jan 30, 2019
6cc1b31
Merge pull request #753 from abraham/update-ca-cert
abraham Jan 30, 2019
213e861
Update Travis to xenial
abraham Mar 11, 2019
e1ee92a
Allow failures on PHP nightly
abraham Mar 11, 2019
5bf50b8
Merge pull request #761 from abraham/split-ci
abraham Mar 11, 2019
c887a40
Use build matrix on Travis
abraham Mar 11, 2019
eb1b9a6
Cache composer files
abraham Mar 11, 2019
2a8b34f
Merge pull request #762 from abraham/split-ci
abraham Mar 11, 2019
51af46d
Switch mediaInitParameters to an allow list
abraham Mar 11, 2019
0284427
Merge pull request #763 from abraham/cleanup-media-params
abraham Mar 11, 2019
ca3508f
Prefer dist on CI
abraham Mar 11, 2019
0382615
Remove duplicate media_type param
abraham Mar 11, 2019
18b8d05
Merge pull request #764 from abraham/ci-source
abraham Mar 11, 2019
9350ad1
Merge pull request #765 from abraham/cleanup-media-params
abraham Mar 11, 2019
7f4c3e6
Replace curly brackets to square brackets.
hkiciy Aug 12, 2019
a52fdfe
update ca certificate
jpuck Oct 27, 2019
f3f32be
Merge pull request #802 from jpuck/cacert
abraham Oct 27, 2019
534e2d0
Merge pull request #788 from hkiciy/fix-deprecated
abraham Nov 29, 2019
75a83ab
Update cacert
abraham Nov 29, 2019
c04794f
Update to bionic
abraham Nov 29, 2019
b133d35
Merge pull request #808 from abraham/dist
abraham Nov 29, 2019
a9c5f4a
Close curl on network exception
abraham Nov 29, 2019
728fc83
Merge pull request #809 from abraham/cleanup-curl
abraham Nov 29, 2019
9938981
Merge remote-tracking branch 'origin/v1' into v1-backport
abraham Nov 29, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 16 additions & 11 deletions .travis.yml
@@ -1,17 +1,22 @@
language: php
dist: trusty
dist: bionic
php:
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- nightly
- hhvm
sudo: false
before_script:
- composer self-update
- composer install --prefer-source --no-interaction
script:
- vendor/bin/phpcs src tests --standard=PSR2
- tests/scripts/cacert.sh
- vendor/bin/phpunit
- composer self-update
- composer install --no-interaction
script: vendor/bin/phpunit
matrix:
allow_failures:
- php: nightly
include:
- name: Lint
script: vendor/bin/phpcs src tests --standard=PSR2
- name: cacert.pem current
script: tests/scripts/cacert.sh
cache:
directories:
- $HOME/.composer/cache/files
3 changes: 2 additions & 1 deletion README.md
@@ -1,4 +1,5 @@
<span itemprop="name">TwitterOAuth</span> [![Build Status](https://img.shields.io/travis/abraham/twitteroauth.svg)](https://travis-ci.org/abraham/twitteroauth) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/abraham/twitteroauth/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/abraham/twitteroauth/?branch=master) [![Issues Count](https://img.shields.io/github/issues/abraham/twitteroauth.svg)](https://github.com/abraham/twitteroauth/issues) [![Latest Version](https://img.shields.io/packagist/v/abraham/twitteroauth.svg)](https://packagist.org/packages/abraham/twitteroauth)
<span itemprop="name">TwitterOAuth</span> [![Build Status](https://img.shields.io/travis/abraham/twitteroauth.svg)](https://travis-ci.org/abraham/twitteroauth) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/abraham/twitteroauth/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/abraham/twitteroauth/?branch=master) [![Issues Count](https://img.shields.io/github/issues/abraham/twitteroauth.svg)](https://github.com/abraham/twitteroauth/issues) [![Latest Version](https://img.shields.io/packagist/v/abraham/twitteroauth.svg)](https://packagist.org/packages/abraham/twitteroauth) [![Downloads this Month](https://img.shields.io/packagist/dm/abraham/twitteroauth.svg)](https://packagist.org/packages/abraham/twitteroauth)

------------

<p itemprop="description">The most popular PHP library for Twitter's OAuth REST API.</p>
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -18,7 +18,7 @@
"issues": "https://github.com/abraham/twitteroauth/issues"
},
"require": {
"php": "^5.6 || ^7.0 || ^7.1 || ^7.2",
"php": "^7.2 || ^7.3",
"ext-curl": "*"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/SignatureMethod.php
Expand Up @@ -58,7 +58,7 @@ public function checkSignature(Request $request, Consumer $consumer, Token $toke
// Avoid a timing leak with a (hopefully) time insensitive compare
$result = 0;
for ($i = 0; $i < strlen($signature); $i++) {
$result |= ord($built{$i}) ^ ord($signature{$i});
$result |= ord($built[$i]) ^ ord($signature[$i]);
}

return $result == 0;
Expand Down
18 changes: 8 additions & 10 deletions src/TwitterOAuth.php
Expand Up @@ -341,18 +341,13 @@ private function uploadMediaChunked($path, array $parameters)
*/
private function mediaInitParameters(array $parameters)
{
$return = [
$allowed_keys = ['media_type', 'additional_owners', 'media_category', 'shared'];
$base = [
'command' => 'INIT',
'media_type' => $parameters['media_type'],
'total_bytes' => filesize($parameters['media'])
];
if (isset($parameters['additional_owners'])) {
$return['additional_owners'] = $parameters['additional_owners'];
}
if (isset($parameters['media_category'])) {
$return['media_category'] = $parameters['media_category'];
}
return $return;
$allowed_parameters = array_intersect_key($parameters, array_flip($allowed_keys));
return array_merge($base, $allowed_parameters);
}

/**
Expand Down Expand Up @@ -548,7 +543,10 @@ private function request($url, $method, $authorization, array $postfields, $json

// Throw exceptions on cURL errors.
if (curl_errno($curlHandle) > 0) {
throw new TwitterOAuthException(curl_error($curlHandle), curl_errno($curlHandle));
$error = curl_error($curlHandle);
$errorNo = curl_errno($curlHandle);
curl_close($curlHandle);
throw new TwitterOAuthException($error, $errorNo);
}

$this->response->setHttpCode(curl_getinfo($curlHandle, CURLINFO_HTTP_CODE));
Expand Down