composer updates

This commit is contained in:
Andreas Gohr 2024-03-05 15:08:02 +01:00
parent ff6a7a9d5f
commit c13ef3ba1d
20 changed files with 267 additions and 95 deletions

48
composer.lock generated
View File

@ -152,16 +152,16 @@
},
{
"name": "openpsa/universalfeedcreator",
"version": "v1.8.6",
"version": "v1.9.0",
"source": {
"type": "git",
"url": "https://github.com/flack/UniversalFeedCreator.git",
"reference": "3abf36ef9d3a3b31a3c330caea7d5176f0396301"
"reference": "c55f908e867aa6dade0905b8aefb94fd9d8c1f9e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/flack/UniversalFeedCreator/zipball/3abf36ef9d3a3b31a3c330caea7d5176f0396301",
"reference": "3abf36ef9d3a3b31a3c330caea7d5176f0396301",
"url": "https://api.github.com/repos/flack/UniversalFeedCreator/zipball/c55f908e867aa6dade0905b8aefb94fd9d8c1f9e",
"reference": "c55f908e867aa6dade0905b8aefb94fd9d8c1f9e",
"shasum": ""
},
"require": {
@ -201,9 +201,9 @@
],
"support": {
"issues": "https://github.com/flack/UniversalFeedCreator/issues",
"source": "https://github.com/flack/UniversalFeedCreator/tree/v1.8.6"
"source": "https://github.com/flack/UniversalFeedCreator/tree/v1.9.0"
},
"time": "2024-01-23T15:59:31+00:00"
"time": "2024-02-22T11:08:24+00:00"
},
{
"name": "paragonie/constant_time_encoding",
@ -324,16 +324,16 @@
},
{
"name": "phpseclib/phpseclib",
"version": "3.0.35",
"version": "3.0.37",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
"reference": "4b1827beabce71953ca479485c0ae9c51287f2fe"
"reference": "cfa2013d0f68c062055180dd4328cc8b9d1f30b8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/4b1827beabce71953ca479485c0ae9c51287f2fe",
"reference": "4b1827beabce71953ca479485c0ae9c51287f2fe",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/cfa2013d0f68c062055180dd4328cc8b9d1f30b8",
"reference": "cfa2013d0f68c062055180dd4328cc8b9d1f30b8",
"shasum": ""
},
"require": {
@ -414,7 +414,7 @@
],
"support": {
"issues": "https://github.com/phpseclib/phpseclib/issues",
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.35"
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.37"
},
"funding": [
{
@ -430,7 +430,7 @@
"type": "tidelift"
}
],
"time": "2023-12-29T01:59:53+00:00"
"time": "2024-03-03T02:14:58+00:00"
},
{
"name": "simplepie/simplepie",
@ -510,16 +510,16 @@
},
{
"name": "splitbrain/lesserphp",
"version": "v0.10.0",
"version": "v0.10.1",
"source": {
"type": "git",
"url": "https://github.com/splitbrain/lesserphp.git",
"reference": "2e5d20c4ce9186a34554a137a4a1784fc5c29505"
"reference": "64e2ab63ddd399d9ef071e9a6bd778c6ddcc8db0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/splitbrain/lesserphp/zipball/2e5d20c4ce9186a34554a137a4a1784fc5c29505",
"reference": "2e5d20c4ce9186a34554a137a4a1784fc5c29505",
"url": "https://api.github.com/repos/splitbrain/lesserphp/zipball/64e2ab63ddd399d9ef071e9a6bd778c6ddcc8db0",
"reference": "64e2ab63ddd399d9ef071e9a6bd778c6ddcc8db0",
"shasum": ""
},
"require": {
@ -565,9 +565,9 @@
"description": "lesserphp is a compiler for LESS written in PHP based on leafo's lessphp.",
"support": {
"issues": "https://github.com/splitbrain/lesserphp/issues",
"source": "https://github.com/splitbrain/lesserphp/tree/v0.10.0"
"source": "https://github.com/splitbrain/lesserphp/tree/v0.10.1"
},
"time": "2024-02-02T11:47:26+00:00"
"time": "2024-02-02T18:31:26+00:00"
},
{
"name": "splitbrain/php-archive",
@ -736,16 +736,16 @@
},
{
"name": "splitbrain/slika",
"version": "1.0.6",
"version": "1.0.7",
"source": {
"type": "git",
"url": "https://github.com/splitbrain/slika.git",
"reference": "274511fc654fa29cb7cfc039bed97a5ea786f1a0"
"reference": "93cd2034628136b4fa322f7f1ac3d57293a6c08d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/splitbrain/slika/zipball/274511fc654fa29cb7cfc039bed97a5ea786f1a0",
"reference": "274511fc654fa29cb7cfc039bed97a5ea786f1a0",
"url": "https://api.github.com/repos/splitbrain/slika/zipball/93cd2034628136b4fa322f7f1ac3d57293a6c08d",
"reference": "93cd2034628136b4fa322f7f1ac3d57293a6c08d",
"shasum": ""
},
"require": {
@ -777,9 +777,9 @@
"description": "Simple image resizing",
"support": {
"issues": "https://github.com/splitbrain/slika/issues",
"source": "https://github.com/splitbrain/slika/tree/1.0.6"
"source": "https://github.com/splitbrain/slika/tree/1.0.7"
},
"time": "2023-10-26T10:06:48+00:00"
"time": "2024-01-28T09:41:46+00:00"
}
],
"packages-dev": [],

View File

@ -19,6 +19,7 @@ return array(
'HTMLCreator' => $vendorDir . '/openpsa/universalfeedcreator/lib/Creator/HTMLCreator.php',
'HtmlDescribable' => $vendorDir . '/openpsa/universalfeedcreator/lib/Element/HtmlDescribable.php',
'JSCreator' => $vendorDir . '/openpsa/universalfeedcreator/lib/Creator/JSCreator.php',
'JSONCreator' => $vendorDir . '/openpsa/universalfeedcreator/lib/Creator/JSONCreator.php',
'KMLCreator' => $vendorDir . '/openpsa/universalfeedcreator/lib/Creator/KMLCreator.php',
'MBOXCreator' => $vendorDir . '/openpsa/universalfeedcreator/lib/Creator/MBOXCreator.php',
'OPMLCreator' => $vendorDir . '/openpsa/universalfeedcreator/lib/Creator/OPMLCreator.php',

View File

@ -131,6 +131,7 @@ class ComposerStaticInita19a915ee98347a0c787119619d2ff9b
'HTMLCreator' => __DIR__ . '/..' . '/openpsa/universalfeedcreator/lib/Creator/HTMLCreator.php',
'HtmlDescribable' => __DIR__ . '/..' . '/openpsa/universalfeedcreator/lib/Element/HtmlDescribable.php',
'JSCreator' => __DIR__ . '/..' . '/openpsa/universalfeedcreator/lib/Creator/JSCreator.php',
'JSONCreator' => __DIR__ . '/..' . '/openpsa/universalfeedcreator/lib/Creator/JSONCreator.php',
'KMLCreator' => __DIR__ . '/..' . '/openpsa/universalfeedcreator/lib/Creator/KMLCreator.php',
'MBOXCreator' => __DIR__ . '/..' . '/openpsa/universalfeedcreator/lib/Creator/MBOXCreator.php',
'OPMLCreator' => __DIR__ . '/..' . '/openpsa/universalfeedcreator/lib/Creator/OPMLCreator.php',

View File

@ -151,17 +151,17 @@
},
{
"name": "openpsa/universalfeedcreator",
"version": "v1.8.6",
"version_normalized": "1.8.6.0",
"version": "v1.9.0",
"version_normalized": "1.9.0.0",
"source": {
"type": "git",
"url": "https://github.com/flack/UniversalFeedCreator.git",
"reference": "3abf36ef9d3a3b31a3c330caea7d5176f0396301"
"reference": "c55f908e867aa6dade0905b8aefb94fd9d8c1f9e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/flack/UniversalFeedCreator/zipball/3abf36ef9d3a3b31a3c330caea7d5176f0396301",
"reference": "3abf36ef9d3a3b31a3c330caea7d5176f0396301",
"url": "https://api.github.com/repos/flack/UniversalFeedCreator/zipball/c55f908e867aa6dade0905b8aefb94fd9d8c1f9e",
"reference": "c55f908e867aa6dade0905b8aefb94fd9d8c1f9e",
"shasum": ""
},
"require": {
@ -170,7 +170,7 @@
"require-dev": {
"phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.32 || ^9.5.10"
},
"time": "2024-01-23T15:59:31+00:00",
"time": "2024-02-22T11:08:24+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -203,7 +203,7 @@
],
"support": {
"issues": "https://github.com/flack/UniversalFeedCreator/issues",
"source": "https://github.com/flack/UniversalFeedCreator/tree/v1.8.6"
"source": "https://github.com/flack/UniversalFeedCreator/tree/v1.9.0"
},
"install-path": "../openpsa/universalfeedcreator"
},
@ -332,17 +332,17 @@
},
{
"name": "phpseclib/phpseclib",
"version": "3.0.35",
"version_normalized": "3.0.35.0",
"version": "3.0.37",
"version_normalized": "3.0.37.0",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
"reference": "4b1827beabce71953ca479485c0ae9c51287f2fe"
"reference": "cfa2013d0f68c062055180dd4328cc8b9d1f30b8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/4b1827beabce71953ca479485c0ae9c51287f2fe",
"reference": "4b1827beabce71953ca479485c0ae9c51287f2fe",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/cfa2013d0f68c062055180dd4328cc8b9d1f30b8",
"reference": "cfa2013d0f68c062055180dd4328cc8b9d1f30b8",
"shasum": ""
},
"require": {
@ -360,7 +360,7 @@
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.",
"ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations."
},
"time": "2023-12-29T01:59:53+00:00",
"time": "2024-03-03T02:14:58+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -425,7 +425,7 @@
],
"support": {
"issues": "https://github.com/phpseclib/phpseclib/issues",
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.35"
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.37"
},
"funding": [
{
@ -524,17 +524,17 @@
},
{
"name": "splitbrain/lesserphp",
"version": "v0.10.0",
"version_normalized": "0.10.0.0",
"version": "v0.10.1",
"version_normalized": "0.10.1.0",
"source": {
"type": "git",
"url": "https://github.com/splitbrain/lesserphp.git",
"reference": "2e5d20c4ce9186a34554a137a4a1784fc5c29505"
"reference": "64e2ab63ddd399d9ef071e9a6bd778c6ddcc8db0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/splitbrain/lesserphp/zipball/2e5d20c4ce9186a34554a137a4a1784fc5c29505",
"reference": "2e5d20c4ce9186a34554a137a4a1784fc5c29505",
"url": "https://api.github.com/repos/splitbrain/lesserphp/zipball/64e2ab63ddd399d9ef071e9a6bd778c6ddcc8db0",
"reference": "64e2ab63ddd399d9ef071e9a6bd778c6ddcc8db0",
"shasum": ""
},
"require": {
@ -548,7 +548,7 @@
"suggest": {
"ext-fileinfo": "For mime type guessing of embedded files"
},
"time": "2024-02-02T11:47:26+00:00",
"time": "2024-02-02T18:31:26+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -582,7 +582,7 @@
"description": "lesserphp is a compiler for LESS written in PHP based on leafo's lessphp.",
"support": {
"issues": "https://github.com/splitbrain/lesserphp/issues",
"source": "https://github.com/splitbrain/lesserphp/tree/v0.10.0"
"source": "https://github.com/splitbrain/lesserphp/tree/v0.10.1"
},
"install-path": "../splitbrain/lesserphp"
},
@ -762,17 +762,17 @@
},
{
"name": "splitbrain/slika",
"version": "1.0.6",
"version_normalized": "1.0.6.0",
"version": "1.0.7",
"version_normalized": "1.0.7.0",
"source": {
"type": "git",
"url": "https://github.com/splitbrain/slika.git",
"reference": "274511fc654fa29cb7cfc039bed97a5ea786f1a0"
"reference": "93cd2034628136b4fa322f7f1ac3d57293a6c08d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/splitbrain/slika/zipball/274511fc654fa29cb7cfc039bed97a5ea786f1a0",
"reference": "274511fc654fa29cb7cfc039bed97a5ea786f1a0",
"url": "https://api.github.com/repos/splitbrain/slika/zipball/93cd2034628136b4fa322f7f1ac3d57293a6c08d",
"reference": "93cd2034628136b4fa322f7f1ac3d57293a6c08d",
"shasum": ""
},
"require": {
@ -784,7 +784,7 @@
"suggest": {
"ext-gd": "PHP's builtin image manipulation library. Alternatively use an installation of ImageMagick"
},
"time": "2023-10-26T10:06:48+00:00",
"time": "2024-01-28T09:41:46+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -806,7 +806,7 @@
"description": "Simple image resizing",
"support": {
"issues": "https://github.com/splitbrain/slika/issues",
"source": "https://github.com/splitbrain/slika/tree/1.0.6"
"source": "https://github.com/splitbrain/slika/tree/1.0.7"
},
"install-path": "../splitbrain/slika"
}

View File

@ -3,7 +3,7 @@
'name' => 'dokuwiki/dokuwiki',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '87f6c7185502767dd23d1039195eed23f0048dd1',
'reference' => 'ff6a7a9d5faee648df31090bfa612e064ab19bfd',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -22,7 +22,7 @@
'dokuwiki/dokuwiki' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '87f6c7185502767dd23d1039195eed23f0048dd1',
'reference' => 'ff6a7a9d5faee648df31090bfa612e064ab19bfd',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -50,9 +50,9 @@
'dev_requirement' => false,
),
'openpsa/universalfeedcreator' => array(
'pretty_version' => 'v1.8.6',
'version' => '1.8.6.0',
'reference' => '3abf36ef9d3a3b31a3c330caea7d5176f0396301',
'pretty_version' => 'v1.9.0',
'version' => '1.9.0.0',
'reference' => 'c55f908e867aa6dade0905b8aefb94fd9d8c1f9e',
'type' => 'library',
'install_path' => __DIR__ . '/../openpsa/universalfeedcreator',
'aliases' => array(),
@ -77,9 +77,9 @@
'dev_requirement' => false,
),
'phpseclib/phpseclib' => array(
'pretty_version' => '3.0.35',
'version' => '3.0.35.0',
'reference' => '4b1827beabce71953ca479485c0ae9c51287f2fe',
'pretty_version' => '3.0.37',
'version' => '3.0.37.0',
'reference' => 'cfa2013d0f68c062055180dd4328cc8b9d1f30b8',
'type' => 'library',
'install_path' => __DIR__ . '/../phpseclib/phpseclib',
'aliases' => array(),
@ -95,9 +95,9 @@
'dev_requirement' => false,
),
'splitbrain/lesserphp' => array(
'pretty_version' => 'v0.10.0',
'version' => '0.10.0.0',
'reference' => '2e5d20c4ce9186a34554a137a4a1784fc5c29505',
'pretty_version' => 'v0.10.1',
'version' => '0.10.1.0',
'reference' => '64e2ab63ddd399d9ef071e9a6bd778c6ddcc8db0',
'type' => 'library',
'install_path' => __DIR__ . '/../splitbrain/lesserphp',
'aliases' => array(),
@ -131,9 +131,9 @@
'dev_requirement' => false,
),
'splitbrain/slika' => array(
'pretty_version' => '1.0.6',
'version' => '1.0.6.0',
'reference' => '274511fc654fa29cb7cfc039bed97a5ea786f1a0',
'pretty_version' => '1.0.7',
'version' => '1.0.7.0',
'reference' => '93cd2034628136b4fa322f7f1ac3d57293a6c08d',
'type' => 'library',
'install_path' => __DIR__ . '/../splitbrain/slika',
'aliases' => array(),

View File

@ -0,0 +1,66 @@
<?php
/**
* JSONCreator is a FeedCreator that implements the JSON Feed specification,
* as in https://jsonfeed.org/version/1.1
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
class JSONCreator extends FeedCreator
{
/** @inheritdoc */
public function createFeed()
{
$data = array();
$data['version'] = 'https://jsonfeed.org/version/1.1';
$data['title'] = (string)$this->title;
$data['home_page_url'] = (string)$this->link;
$data['feed_url'] = (string)$this->syndicationURL;
$data['description'] = (string)$this->description;
$data['user_comment'] = 'Created by ' . FEEDCREATOR_VERSION;
if ($this->image != null) {
$data['icon'] = $this->image->url;
}
if ($this->language != '') {
$data['language'] = $this->language;
}
$data['items'] = array();
foreach ($this->items as $item) {
$entry = array();
$entry['id'] = $item->guid ? (string)$item->guid : (string)$item->link;
$entry['url'] = (string)$item->link;
if ($item->source) {
$entry['external_url'] = (string)$item->source;
}
$entry['title'] = strip_tags((string)$item->title);
$entry['content_text'] = strip_tags((string)$item->description);
$entry['content_html'] = (string)$item->description;
$entry['date_published'] = (new FeedDate($item->date))->iso8601();
if ($item->author) {
// We only support one author, JSONFeed 1.1 accepts multiple
$entry['authors'] = array(array('name' => (string)$item->author));
// 1.0 only supported one, for compatibility we set it as well
$entry['author'] = array('name' => (string)$item->author);
}
if ($item->category) {
$entry['tags'] = (array)$item->category;
}
if ($item->enclosure) {
// We only support one enclosure, JSONFeed 1.1 accepts multiple
$entry['attachments'] = array(
array(
'url' => $item->enclosure['url'],
'mime_type' => $item->enclosure['type'],
'size_in_bytes' => $item->enclosure['length']
)
);
}
$data['items'][] = $entry;
}
return json_encode($data);
}
}

View File

@ -88,6 +88,10 @@ class UniversalFeedCreator extends FeedCreator
$this->_feed = new JSCreator();
break;
case "JSON":
$this->_feed = new JSONCreator();
break;
default:
$this->_feed = new RSSCreator091();
break;

View File

@ -13,4 +13,5 @@ phpseclib ongoing development is made possible by [Tidelift](https://tidelift.co
- [Rachel Fish](https://github.com/itsrachelfish)
- Tharyrok
- [cjhaas](https://github.com/cjhaas)
- [istiak-tridip](https://github.com/istiak-tridip)
- [istiak-tridip](https://github.com/istiak-tridip)
- [Anna Filina](https://github.com/afilina)

View File

@ -51,7 +51,7 @@ SSH-2, SFTP, X.509, an arbitrary-precision integer arithmetic library, Ed25519 /
* PHP4 compatible
* Composer compatible (PSR-0 autoloading)
* Install using Composer: `composer require phpseclib/phpseclib:~1.0`
* [Download 1.0.22 as ZIP](http://sourceforge.net/projects/phpseclib/files/phpseclib1.0.22.zip/download)
* [Download 1.0.23 as ZIP](http://sourceforge.net/projects/phpseclib/files/phpseclib1.0.23.zip/download)
## Security contact information

View File

@ -150,7 +150,7 @@ final class PrivateKey extends EC implements Common\PrivateKey
// we use specified curves to avoid issues with OpenSSL possibly not supporting a given named curve;
// doing this may mean some curve-specific optimizations can't be used but idk if OpenSSL even
// has curve-specific optimizations
$result = openssl_sign($message, $signature, $this->toString('PKCS8', ['namedCurve' => false]), $this->hash->getHash());
$result = openssl_sign($message, $signature, $this->withPassword()->toString('PKCS8', ['namedCurve' => false]), $this->hash->getHash());
if ($result) {
if ($shortFormat == 'ASN1') {

View File

@ -1148,6 +1148,11 @@ abstract class ASN1
$oid = [];
$pos = 0;
$len = strlen($content);
// see https://github.com/openjdk/jdk/blob/2deb318c9f047ec5a4b160d66a4b52f93688ec42/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java#L55
if ($len > 4096) {
//throw new \RuntimeException("Object identifier size is limited to 4096 bytes ($len bytes present)");
return false;
}
if (ord($content[$len - 1]) & 0x80) {
return false;

View File

@ -619,7 +619,7 @@ abstract class Engine implements \JsonSerializable
*/
public function getLengthInBytes()
{
return strlen($this->toBytes());
return (int) ceil($this->getLength() / 8);
}
/**
@ -786,6 +786,11 @@ abstract class Engine implements \JsonSerializable
$min = $temp;
}
$length = $max->getLength();
if ($length > 8196) {
throw new \RuntimeException("Generation of random prime numbers larger than 8196 has been disabled ($length)");
}
$x = static::randomRange($min, $max);
return static::randomRangePrimeInner($x, $min, $max);
@ -990,6 +995,15 @@ abstract class Engine implements \JsonSerializable
*/
public function isPrime($t = false)
{
// OpenSSL limits RSA keys to 16384 bits. The length of an RSA key is equal to the length of the modulo, which is
// produced by multiplying the primes p and q by one another. The largest number two 8196 bit primes can produce is
// a 16384 bit number so, basically, 8196 bit primes are the largest OpenSSL will generate and if that's the largest
// that it'll generate it also stands to reason that that's the largest you'll be able to test primality on
$length = $this->getLength();
if ($length > 8196) {
throw new \RuntimeException("Primality testing is not supported for numbers larger than 8196 bits ($length)");
}
if (!$t) {
$t = $this->setupIsPrime();
}

View File

@ -1341,4 +1341,17 @@ abstract class PHP extends Engine
}
return false;
}
/**
* Return the size of a BigInteger in bits
*
* @return int
*/
public function getLength()
{
$max = count($this->value) - 1;
return $max != -1 ?
$max * static::BASE + intval(ceil(log($this->value[$max] + 1, 2))) :
0;
}
}

View File

@ -547,7 +547,7 @@ class SFTP extends SSH2
*/
private function partial_init_sftp_connection()
{
$response = $this->openChannel(self::CHANNEL, true);
$response = $this->open_channel(self::CHANNEL, true);
if ($response === true && $this->isTimeout()) {
return false;
}
@ -2129,8 +2129,8 @@ class SFTP extends SSH2
$offset = $start;
} elseif ($mode & (self::RESUME | self::RESUME_START)) {
// if NET_SFTP_OPEN_APPEND worked as it should _size() wouldn't need to be called
$size = $this->stat($remote_file)['size'];
$offset = $size !== false ? $size : 0;
$stat = $this->stat($remote_file);
$offset = $stat !== false && $stat['size'] ? $stat['size'] : 0;
} else {
$offset = 0;
if ($this->version >= 5) {
@ -3446,7 +3446,7 @@ class SFTP extends SSH2
}
/**
* Returns all errors
* Returns all errors on the SFTP layer
*
* @return array
*/
@ -3456,7 +3456,7 @@ class SFTP extends SSH2
}
/**
* Returns the last error
* Returns the last error on the SFTP layer
*
* @return string
*/

View File

@ -1116,6 +1116,8 @@ class SSH2
* Default Constructor.
*
* $host can either be a string, representing the host, or a stream resource.
* If $host is a stream resource then $port doesn't do anything, altho $timeout
* still will be used
*
* @param mixed $host
* @param int $port
@ -1214,6 +1216,8 @@ class SSH2
? \WeakReference::create($this)
: $this;
$this->timeout = $timeout;
if (is_resource($host)) {
$this->fsock = $host;
return;
@ -1222,7 +1226,6 @@ class SSH2
if (Strings::is_stringable($host)) {
$this->host = $host;
$this->port = $port;
$this->timeout = $timeout;
}
}
@ -2837,7 +2840,7 @@ class SSH2
// throw new \RuntimeException('If you want to run multiple exec()\'s you will need to disable (and re-enable if appropriate) a PTY for each one.');
//}
$this->openChannel(self::CHANNEL_EXEC);
$this->open_channel(self::CHANNEL_EXEC);
if ($this->request_pty === true) {
$terminal_modes = pack('C', NET_SSH2_TTY_OP_END);
@ -2934,7 +2937,7 @@ class SSH2
* @param bool $skip_extended
* @return bool
*/
protected function openChannel($channel, $skip_extended = false)
protected function open_channel($channel, $skip_extended = false)
{
if (isset($this->channel_status[$channel]) && $this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_CLOSE) {
throw new \RuntimeException('Please close the channel (' . $channel . ') before trying to open it again');
@ -2991,7 +2994,7 @@ class SSH2
throw new InsufficientSetupException('Operation disallowed prior to login()');
}
$this->openChannel(self::CHANNEL_SHELL);
$this->open_channel(self::CHANNEL_SHELL);
$terminal_modes = pack('C', NET_SSH2_TTY_OP_END);
$packet = Strings::packSSH2(
@ -3239,7 +3242,7 @@ class SSH2
*/
public function startSubsystem($subsystem)
{
$this->openChannel(self::CHANNEL_SUBSYSTEM);
$this->open_channel(self::CHANNEL_SUBSYSTEM);
$packet = Strings::packSSH2(
'CNsCs',
@ -3341,11 +3344,38 @@ class SSH2
/**
* Is the connection still active?
*
* $level has 3x possible values:
* 0 (default): phpseclib takes a passive approach to see if the connection is still active by calling feof()
* on the socket
* 1: phpseclib takes an active approach to see if the connection is still active by sending an SSH_MSG_IGNORE
* packet that doesn't require a response
* 2: phpseclib takes an active approach to see if the connection is still active by sending an SSH_MSG_CHANNEL_OPEN
* packet and imediately trying to close that channel. some routers, in particular, however, will only let you
* open one channel, so this approach could yield false positives
*
* @param int $level
* @return bool
*/
public function isConnected()
public function isConnected($level = 0)
{
return ($this->bitmap & self::MASK_CONNECTED) && is_resource($this->fsock) && !feof($this->fsock);
if (!is_int($level) || $level < 0 || $level > 2) {
throw new \InvalidArgumentException('$level must be 0, 1 or 2');
}
if ($level == 0) {
return ($this->bitmap & self::MASK_CONNECTED) && is_resource($this->fsock) && !feof($this->fsock);
}
try {
if ($level == 1) {
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_IGNORE, 0));
} else {
$this->open_channel(self::CHANNEL_KEEP_ALIVE);
$this->close_channel(self::CHANNEL_KEEP_ALIVE);
}
return true;
} catch (\Exception $e) {
return false;
}
}
/**
@ -3418,7 +3448,7 @@ class SSH2
}
try {
$this->openChannel(self::CHANNEL_KEEP_ALIVE);
$this->open_channel(self::CHANNEL_KEEP_ALIVE);
} catch (\RuntimeException $e) {
return $this->reconnect();
}
@ -3531,6 +3561,11 @@ class SSH2
}
$start = microtime(true);
if ($this->curTimeout) {
$sec = (int) floor($this->curTimeout);
$usec = (int) (1000000 * ($this->curTimeout - $sec));
stream_set_timeout($this->fsock, $sec, $usec);
}
$raw = stream_get_contents($this->fsock, $this->decrypt_block_size);
if (!strlen($raw)) {
@ -4724,7 +4759,9 @@ class SSH2
}
/**
* Returns all errors
* Returns all errors / debug messages on the SSH layer
*
* If you are looking for messages from the SFTP layer, please see SFTP::getSFTPErrors()
*
* @return string[]
*/
@ -4734,7 +4771,9 @@ class SSH2
}
/**
* Returns the last error
* Returns the last error received on the SSH layer
*
* If you are looking for messages from the SFTP layer, please see SFTP::getLastSFTPError()
*
* @return string
*/

View File

@ -41,7 +41,7 @@
"rector/rector": "^0.19"
},
"scripts": {
"test": "phpunit --verbose",
"test": "phpunit",
"check": "phpcs -p -s",
"fix": "phpcbf",
"rector": "rector process"

View File

@ -2,6 +2,7 @@
namespace LesserPHP\Functions;
use LesserPHP\Utils\Asserts;
use LesserPHP\Utils\Color;
use LesserPHP\Utils\Util;
@ -20,12 +21,12 @@ class Type extends AbstractFunctionCollection
'isstring' => [$this, 'isstring'],
'iscolor' => [$this, 'iscolor'],
'iskeyword' => [$this, 'iskeyword'],
//'isurl' => [$this, 'isurl'],
'isurl' => [$this, 'isurl'],
'ispixel' => [$this, 'ispixel'],
'isem' => [$this, 'isem'],
'isrem' => [$this, 'isrem'],
'ispercentage' => [$this, 'ispercentage'],
//'isunit' => [$this, 'isunit'],
'isunit' => [$this, 'isunit'],
//'isruleset' => [$this, 'isruleset'],
//'isdefined' => [$this, 'isdefined'],
];
@ -72,7 +73,15 @@ class Type extends AbstractFunctionCollection
return Util::toBool($value[0] == 'keyword');
}
// isurl is missing
/**
* Returns true if a value is a url, false otherwise
*
* @link https://lesscss.org/functions/#type-functions-isurl
*/
public function isurl(array $value): array
{
return Util::toBool($value[0] == 'function' && $value[1] == 'url');
}
/**
* Returns true if a value is a number in pixels, false otherwise
@ -114,7 +123,22 @@ class Type extends AbstractFunctionCollection
return Util::toBool($value[0] == 'number' && $value[2] == '%');
}
// isunit is missing
/**
* Returns true if a value is a number with a given unit, false otherwise
*
* @link https://lesscss.org/functions/#type-functions-isunit
*/
public function isunit(array $args): array
{
[$input, $unit] = Asserts::assertArgs($args, 2, 'isunit');
$unit = $this->lessc->compileValue($this->lessc->unwrap($unit));
return Util::toBool(
$input[0] == 'number' &&
$input[2] == $unit
);
}
// isruleset is missing
// isdefined is missing
}

View File

@ -70,7 +70,7 @@ class Lessc
protected ?stdClass $env = null;
/** @var stdClass|null The currently parsed block FIXME should probably be its own proper class */
protected ?stdClass $scope;
protected ?stdClass $scope = null;
/** @var array [file => mtime] list of all files that have been parsed, to avoid circular imports */
protected array $allParsedFiles = [];

View File

@ -142,7 +142,11 @@ class Parser
}
if ($this->count != strlen($this->buffer)) {
$this->throwError();
$this->throwError(sprintf(
"parse error: count mismatches buffer length %d != %d",
$this->count,
strlen($this->buffer)
));
}
// TODO report where the block was opened

View File

@ -90,13 +90,13 @@ class GdAdapter extends Adapter
// rotate
if (in_array($orientation, [3, 4])) {
$image = imagerotate($this->image, 180, $transparency, 1);
$image = imagerotate($this->image, 180, $transparency);
}
if (in_array($orientation, [5, 6])) {
$image = imagerotate($this->image, -90, $transparency, 1);
$image = imagerotate($this->image, -90, $transparency);
list($this->width, $this->height) = [$this->height, $this->width];
} elseif (in_array($orientation, [7, 8])) {
$image = imagerotate($this->image, 90, $transparency, 1);
$image = imagerotate($this->image, 90, $transparency);
list($this->width, $this->height) = [$this->height, $this->width];
}
/** @var resource $image is now defined */