[英]Restler not accepting boolean false
In my Restler API class I have an object defined like so (with lots of other params) 在我的Restler API类中,我有一个像这样定义的对象(有很多其他参数)
class PatchTaskObj extends TaskObj {
/**
* @var bool|null Whether or not this Task should be pinned to the top of the list {@required false}
*/
public $pinned = null;
}
And then I attempt to use it in my PATCH method: 然后我尝试在我的PATCH方法中使用它:
/**
* Updates an existing Task record.
*
* @param int $id The SQL ident of the task you wish to update. {@min 1} {@from path}
* @param PatchTaskObj $info The properties of the Task to update.
*
* @throws RestException 412 Thrown if at least one update isn't passed in.
*
* @status 204
*/
function patch($id, PatchTaskObj $info)
If I pass in true
for the pinned
property it works fine, but if I pass false
then I get a 400 from Restler with the message: 如果我传入
true
作为pinned
属性它工作正常,但如果我传递false
那么我从Restler得到一个400消息:
Bad Request: Invalid value specified for
info[pinned]
错误请求:为
info[pinned]
指定的值无效
OK, discovered that Restler's Validator.php is failing to parse the @var property the way it's written. 好的,发现Restler的Validator.php无法按照它的编写方式解析@var属性。 If you remove the
|null
part then it works as expected. 如果删除
|null
部分,则它按预期工作。 I've submitted an issue to the github site. 我已经向github网站提交了一个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.