🇨🇳 Shenzhen,China・🕹Web developer
如果你喜欢我的项目并想支持我,点击这里 ❤️
:cactus: A simple http client wrapper.
🇨🇳 Shenzhen,China・🕹Web developer
如果你喜欢我的项目并想支持我,点击这里 ❤️
http/src/Support/Collection.php
Line 1 in fd1a3c2
看master版本中已经增加了,但没有发布release
做为开源软件应该要严谨,在跨小版本迭代时,不应该直接删除提供的方法,而是应该在 phpdoc 里打上 @deprecated 标识,并说明将在哪个版本中完全移除。
Overtrue\Http\Support\Collection 不支持php8
__set_state(),offsetGet,offsetSet和offsetUnset实现不兼容
Serializable 未实现
public function __set_state(): array
报错了
若 is_resource
结果是 true
,那么 $contents
就是 true
?
应该是 $contents = \is_resource($contents) ? $contents : \fopen($contents, 'r');
吧?
Line 237 in 40009b5
版本:1.2.3
文件:src/Support/Collection.php
PHP版本:8.1
问题描述:
一个形如:
$config = new Collection([
'a' => 'a0',
'b' => [
'b1' => 'b10'
]
]);
var_dump($config->get('b.b1')); //result is "null"
原因:
/**
* @param array $array
* @param string $key
* @param mixed|null $default
*
* @return mixed
*/
public function dotGet($array, $key, $default = null)
{
if (is_null($key)) {
return $array;
}
if (array_key_exists($key, $array)) {
return $array[$key];
}
foreach (explode('.', $key) as $segment) {
if (array_key_exists($segment, $array)) {
$array = $array[$segment];
} else {
return $default;
}
}
// 缺少循环完的返回 return $array;
}
Client类get方法的query参数换成options,之前调用是直接在第二个参数写query数组,现在版本更新后需要把所有get方法的第二个参数更改为['query' => [...]],请问有什么方法可以快速更新代码
位置 Overtrue\Http\Responses\Response
引用了一个不存在的类 use Overtrue\Http\Support\XML
,并且在 toArray
方法中使用了 XML::parse()
这个不存在的类(74行)。
由于所依赖的 monolog 版本不是 v2.0.0,导致无法在 Laravel 6.0 中使用,需要更新,多谢。
示例:
return $this->client->postJson('extension/query', [], ['token' => $this->token]);
data为空,请求的body主体,应该是空的。
但是在Overtrue\Http\Traits\HasHttpRequests@fixJsonIssue里面设置了如下代码,会产生一个body内容为{}
if (empty($options['json'])) {
$options['body'] = \GuzzleHttp\json_encode($options['json'], JSON_FORCE_OBJECT);
} else {
$options['body'] = \GuzzleHttp\json_encode($options['json'], JSON_UNESCAPED_UNICODE);
}
debug结果:
Content-Length: 2
使用
return $this->client->request("extension/query?token={$this->token}", 'POST', [
'headers' => ['Content-Type' => 'application/json']
]);
debug结果:
Content-Length: 0 // 这才是正确的
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.