-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 1.0.0 security fixes, php v8.1+
- Loading branch information
Showing
20 changed files
with
402 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: | ||
- "8.1" | ||
- "8.2" | ||
- "8.3" | ||
composer: [basic] | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/[email protected] | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: xdebug | ||
extensions: zip | ||
tools: composer | ||
|
||
- name: Determine composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=directory::$(composer config cache-dir)" | ||
|
||
- name: Cache composer dependencies | ||
uses: actions/[email protected] | ||
with: | ||
path: ${{ steps.composer-cache.outputs.directory }} | ||
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ matrix.php }}-composer- | ||
|
||
- name: Install dependencies | ||
run: | | ||
if [[ "${{ matrix.composer }}" == "lowest" ]]; then | ||
composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable | ||
fi; | ||
if [[ "${{ matrix.composer }}" == "basic" ]]; then | ||
composer update --prefer-dist --no-interaction | ||
fi; | ||
composer dump-autoload -o | ||
- name: Run tests | ||
run: | | ||
php vendor/bin/phpunit -c tests/phpunit.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,34 @@ | ||
{ | ||
"name": "nategood/httpful", | ||
"description": "A Readable, Chainable, REST friendly, PHP HTTP Client", | ||
"homepage": "http://github.com/nategood/httpful", | ||
"license": "MIT", | ||
"keywords": ["http", "curl", "rest", "restful", "api", "requests"], | ||
"version": "0.3.2", | ||
"authors": [ | ||
{ | ||
"name": "Nate Good", | ||
"email": "[email protected]", | ||
"homepage": "http://nategood.com" | ||
} | ||
], | ||
"require": { | ||
"php": ">=7.2", | ||
"ext-curl": "*" | ||
}, | ||
"autoload": { | ||
"psr-0": { | ||
"Httpful": "src/" | ||
} | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "*" | ||
"name": "nategood/httpful", | ||
"description": "A Readable, Chainable, REST friendly, PHP HTTP Client", | ||
"homepage": "http://github.com/nategood/httpful", | ||
"license": "MIT", | ||
"keywords": [ | ||
"http", | ||
"curl", | ||
"rest", | ||
"restful", | ||
"api", | ||
"requests" | ||
], | ||
"version": "0.3.2", | ||
"authors": [ | ||
{ | ||
"name": "Nate Good", | ||
"email": "[email protected]", | ||
"homepage": "http://nategood.com" | ||
} | ||
], | ||
"require": { | ||
"php": ">=8.1", | ||
"ext-curl": "*" | ||
}, | ||
"autoload": { | ||
"psr-0": { | ||
"Httpful": "src/" | ||
} | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^10.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,10 +23,10 @@ class XmlHandler extends MimeHandlerAdapter | |
/** | ||
* @param array $conf sets configuration options | ||
*/ | ||
public function __construct(array $conf = array()) | ||
public function __construct(array $conf = []) | ||
{ | ||
$this->namespace = isset($conf['namespace']) ? $conf['namespace'] : ''; | ||
$this->libxml_opts = isset($conf['libxml_opts']) ? $conf['libxml_opts'] : 0; | ||
$this->namespace = $conf['namespace'] ?? ''; | ||
$this->libxml_opts = $conf['libxml_opts'] ?? 0; | ||
} | ||
|
||
/** | ||
|
@@ -50,9 +50,9 @@ public function parse($body) | |
* @return string | ||
* @throws \Exception if unable to serialize | ||
*/ | ||
public function serialize($payload) | ||
public function serialize($payload): string | ||
{ | ||
list($_, $dom) = $this->_future_serializeAsXml($payload); | ||
[$_, $dom] = $this->_future_serializeAsXml($payload); | ||
return $dom->saveXml(); | ||
} | ||
|
||
|
@@ -61,7 +61,7 @@ public function serialize($payload) | |
* @return string | ||
* @author Ted Zellers | ||
*/ | ||
public function serialize_clean($payload) | ||
public function serialize_clean($payload): string | ||
{ | ||
$xml = new \XMLWriter; | ||
$xml->openMemory(); | ||
|
@@ -75,7 +75,7 @@ public function serialize_clean($payload) | |
* @param mixed $node to serialize | ||
* @author Ted Zellers | ||
*/ | ||
public function serialize_node(&$xmlw, $node){ | ||
public function serialize_node(&$xmlw, $node) { | ||
if (!is_array($node)){ | ||
$xmlw->text($node); | ||
} else { | ||
|
@@ -90,7 +90,7 @@ public function serialize_node(&$xmlw, $node){ | |
/** | ||
* @author Zack Douglas <[email protected]> | ||
*/ | ||
private function _future_serializeAsXml($value, $node = null, $dom = null) | ||
private function _future_serializeAsXml($value, $node = null, $dom = null): array | ||
{ | ||
if (!$dom) { | ||
$dom = new \DOMDocument; | ||
|
@@ -107,21 +107,21 @@ private function _future_serializeAsXml($value, $node = null, $dom = null) | |
$objNode = $dom->createElement(get_class($value)); | ||
$node->appendChild($objNode); | ||
$this->_future_serializeObjectAsXml($value, $objNode, $dom); | ||
} else if (is_array($value)) { | ||
} elseif (is_array($value)) { | ||
$arrNode = $dom->createElement('array'); | ||
$node->appendChild($arrNode); | ||
$this->_future_serializeArrayAsXml($value, $arrNode, $dom); | ||
} else if (is_bool($value)) { | ||
} elseif (is_bool($value)) { | ||
$node->appendChild($dom->createTextNode($value?'TRUE':'FALSE')); | ||
} else { | ||
$node->appendChild($dom->createTextNode($value)); | ||
} | ||
return array($node, $dom); | ||
return [$node, $dom]; | ||
} | ||
/** | ||
* @author Zack Douglas <[email protected]> | ||
*/ | ||
private function _future_serializeArrayAsXml($value, &$parent, &$dom) | ||
private function _future_serializeArrayAsXml($value, &$parent, &$dom): array | ||
{ | ||
foreach ($value as $k => &$v) { | ||
$n = $k; | ||
|
@@ -132,12 +132,12 @@ private function _future_serializeArrayAsXml($value, &$parent, &$dom) | |
$parent->appendChild($el); | ||
$this->_future_serializeAsXml($v, $el, $dom); | ||
} | ||
return array($parent, $dom); | ||
return [$parent, $dom]; | ||
} | ||
/** | ||
* @author Zack Douglas <[email protected]> | ||
*/ | ||
private function _future_serializeObjectAsXml($value, &$parent, &$dom) | ||
private function _future_serializeObjectAsXml($value, &$parent, &$dom): array | ||
{ | ||
$refl = new \ReflectionObject($value); | ||
foreach ($refl->getProperties() as $pr) { | ||
|
@@ -147,6 +147,6 @@ private function _future_serializeObjectAsXml($value, &$parent, &$dom) | |
$this->_future_serializeAsXml($pr->getValue($value), $el, $dom); | ||
} | ||
} | ||
return array($parent, $dom); | ||
return [$parent, $dom]; | ||
} | ||
} |
Oops, something went wrong.