d3ltcod /
LaravelTube
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | use App\LikeDislike; |
||
| 4 | use App\User; |
||
| 5 | use App\Video; |
||
| 6 | use Chrisbjr\ApiGuard\Models\ApiKey; |
||
| 7 | use Illuminate\Foundation\Testing\DatabaseMigrations; |
||
| 8 | |||
| 9 | class LikeDislikeAPITest extends TestCase |
||
| 10 | { |
||
| 11 | use DatabaseMigrations; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Create fake user. |
||
| 15 | * |
||
| 16 | * @return mixed |
||
| 17 | */ |
||
| 18 | public function createUser() |
||
| 19 | { |
||
| 20 | $user = factory(User::class)->create(); |
||
| 21 | $this->createUserApiKey($user); |
||
|
0 ignored issues
–
show
|
|||
| 22 | |||
| 23 | return $user; |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param User $user |
||
| 28 | * |
||
| 29 | * @return mixed |
||
| 30 | */ |
||
| 31 | private function createUserApiKey(User $user) |
||
| 32 | { |
||
| 33 | $apiKey = ApiKey::make($user->id); |
||
| 34 | $user->apiKey()->save($apiKey); |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Create fake video. |
||
| 39 | * |
||
| 40 | * @return \App\Video |
||
| 41 | */ |
||
| 42 | View Code Duplication | private function createFakeVideo($user) |
|
| 43 | { |
||
| 44 | $faker = Faker\Factory::create(); |
||
| 45 | $video = new Video(); |
||
| 46 | $video->name = $faker->sentence; |
||
|
0 ignored issues
–
show
The property
name does not exist on object<App\Video>. Since you implemented __set, maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 47 | $video->category = $faker->word; |
||
|
0 ignored issues
–
show
The property
category does not exist on object<App\Video>. Since you implemented __set, maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 48 | $video->path = $faker->url; |
||
|
0 ignored issues
–
show
The property
path does not exist on object<App\Video>. Since you implemented __set, maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 49 | $user->getVideos()->save($video); |
||
| 50 | |||
| 51 | $this->createFakeLikes($video->id); |
||
|
0 ignored issues
–
show
The property
id does not exist on object<App\Video>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 52 | |||
| 53 | return $video; |
||
| 54 | } |
||
| 55 | |||
| 56 | View Code Duplication | private function createFakeLikes($video_id) |
|
| 57 | { |
||
| 58 | $video = Video::find($video_id); |
||
| 59 | $type = [ |
||
| 60 | 'like', |
||
| 61 | 'dislike', |
||
| 62 | ]; |
||
| 63 | |||
| 64 | for ($i = 0; $i < 10; $i++) { |
||
| 65 | $user = $this->createUser(); |
||
| 66 | $key = array_rand($type); |
||
| 67 | |||
| 68 | $data = [ |
||
| 69 | 'user_id' => $user->id, |
||
| 70 | 'video_id' => $video->id, |
||
| 71 | 'type' => $type[$key], |
||
| 72 | ]; |
||
| 73 | |||
| 74 | LikeDislike::create($data); |
||
| 75 | } |
||
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * Test likes in database are listed by API. |
||
| 80 | * |
||
| 81 | * @return void |
||
| 82 | */ |
||
| 83 | View Code Duplication | public function testLikesInDatabaseAreListedByAPI() |
|
| 84 | { |
||
| 85 | $user = $this->createUser(); |
||
| 86 | $video = $this->createFakeVideo($user); |
||
| 87 | |||
| 88 | $this->get('/api/videos/'.$video->id.'/likes') |
||
|
0 ignored issues
–
show
The property
id does not exist on object<App\Video>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 89 | ->seeJsonStructure([ |
||
| 90 | '*' => [ |
||
| 91 | '*' => [ |
||
| 92 | 'user_id', 'video_id', 'type', |
||
| 93 | ], |
||
| 94 | ], |
||
| 95 | ])->seeStatusCode(200); |
||
| 96 | } |
||
| 97 | |||
| 98 | /** |
||
| 99 | * Test dislikes in database are listed by API. |
||
| 100 | * |
||
| 101 | * @return void |
||
| 102 | */ |
||
| 103 | View Code Duplication | public function testDislikesInDatabaseAreListedByAPI() |
|
| 104 | { |
||
| 105 | $user = $this->createUser(); |
||
| 106 | $video = $this->createFakeVideo($user); |
||
| 107 | $this->get('/api/videos/'.$video->id.'/dislikes') |
||
|
0 ignored issues
–
show
The property
id does not exist on object<App\Video>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 108 | ->seeJsonStructure([ |
||
| 109 | '*' => [ |
||
| 110 | '*' => [ |
||
| 111 | 'user_id', 'video_id', 'type', |
||
| 112 | ], |
||
| 113 | ], |
||
| 114 | ])->seeStatusCode(200); |
||
| 115 | } |
||
| 116 | |||
| 117 | /** |
||
| 118 | * Test likes count return integer. |
||
| 119 | * |
||
| 120 | * @return void |
||
| 121 | */ |
||
| 122 | View Code Duplication | public function testLikesCountReturnInteger() |
|
| 123 | { |
||
| 124 | $user = $this->createUser(); |
||
| 125 | $video = $this->createFakeVideo($user); |
||
| 126 | $count = $this->get('/api/videos/'.$video->id.'/likes/count'); |
||
|
0 ignored issues
–
show
The property
id does not exist on object<App\Video>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 127 | |||
| 128 | $this->assertTrue(is_int($count->response->original)); |
||
| 129 | } |
||
| 130 | |||
| 131 | /** |
||
| 132 | * Test dislikes count return integer. |
||
| 133 | * |
||
| 134 | * @return void |
||
| 135 | */ |
||
| 136 | View Code Duplication | public function testDisikesCountReturnInteger() |
|
| 137 | { |
||
| 138 | $user = $this->createUser(); |
||
| 139 | $video = $this->createFakeVideo($user); |
||
| 140 | $count = $this->get('/api/videos/'.$video->id.'/dislikes/count'); |
||
|
0 ignored issues
–
show
The property
id does not exist on object<App\Video>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 141 | |||
| 142 | $this->assertTrue(is_int($count->response->original)); |
||
| 143 | } |
||
| 144 | |||
| 145 | /** |
||
| 146 | * Test store like and see in DB. |
||
| 147 | * |
||
| 148 | * @return void |
||
| 149 | */ |
||
| 150 | View Code Duplication | public function testCanBePostLikeAndSeeInDB() |
|
| 151 | { |
||
| 152 | $user = $this->createUser(); |
||
| 153 | $video = $this->createFakeVideo($user); |
||
| 154 | |||
| 155 | $data = [ |
||
| 156 | 'user_id' => $user->id, |
||
| 157 | 'video_id' => $video->id, |
||
|
0 ignored issues
–
show
The property
id does not exist on object<App\Video>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 158 | 'type' => 'like', |
||
| 159 | ]; |
||
| 160 | |||
| 161 | $this->post('/api/videos/'.$video->id.'/like-dislike', $data, ['X-Authorization' => $user->apiKey->key])->seeInDatabase('likes_dislikes', $data); |
||
|
0 ignored issues
–
show
The property
id does not exist on object<App\Video>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 162 | $this->get('/api/videos/'.$video->id.'/likes')->seeJsonContains($data)->seeStatusCode(200); |
||
|
0 ignored issues
–
show
The property
id does not exist on object<App\Video>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 163 | } |
||
| 164 | |||
| 165 | /** |
||
| 166 | * Test delete likeDislike and not see in DB. |
||
| 167 | * |
||
| 168 | * @return void |
||
| 169 | */ |
||
| 170 | View Code Duplication | public function testCanBeDeleteLikeAndSeeInDB() |
|
| 171 | { |
||
| 172 | $user = $this->createUser(); |
||
| 173 | $video = $this->createFakeVideo($user); |
||
| 174 | |||
| 175 | $data = [ |
||
| 176 | 'user_id' => $user->id, |
||
| 177 | 'video_id' => $video->id, |
||
|
0 ignored issues
–
show
The property
id does not exist on object<App\Video>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 178 | 'type' => 'like', |
||
| 179 | ]; |
||
| 180 | |||
| 181 | LikeDislike::create($data); |
||
| 182 | |||
| 183 | $this->post('/api/videos/'.$video->id.'/like-dislike', $data, ['X-Authorization' => $user->apiKey->key])->notSeeInDatabase('likes_dislikes', $data); |
||
|
0 ignored issues
–
show
The property
id does not exist on object<App\Video>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 184 | $this->get('/api/videos/'.$video->id.'/likes')->dontSeeJson([$data])->seeStatusCode(200); |
||
|
0 ignored issues
–
show
The property
id does not exist on object<App\Video>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 185 | } |
||
| 186 | |||
| 187 | /** |
||
| 188 | * Test update type likeDislike and not see in DB. |
||
| 189 | * |
||
| 190 | * @return void |
||
| 191 | */ |
||
| 192 | public function testCanBeUpdateTypeLikeAndSeeInDB() |
||
| 193 | { |
||
| 194 | $user = $this->createUser(); |
||
| 195 | $video = $this->createFakeVideo($user); |
||
| 196 | |||
| 197 | $data = [ |
||
| 198 | 'user_id' => $user->id, |
||
| 199 | 'video_id' => $video->id, |
||
|
0 ignored issues
–
show
The property
id does not exist on object<App\Video>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 200 | 'type' => 'like', |
||
| 201 | ]; |
||
| 202 | |||
| 203 | LikeDislike::create($data); |
||
| 204 | |||
| 205 | $dataUpdate = [ |
||
| 206 | 'user_id' => $user->id, |
||
| 207 | 'video_id' => $video->id, |
||
|
0 ignored issues
–
show
The property
id does not exist on object<App\Video>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 208 | 'type' => 'dislike', |
||
| 209 | ]; |
||
| 210 | |||
| 211 | $this->post('/api/videos/'.$video->id.'/like-dislike', $dataUpdate, ['X-Authorization' => $user->apiKey->key])->seeInDatabase('likes_dislikes', $dataUpdate); |
||
|
0 ignored issues
–
show
The property
id does not exist on object<App\Video>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 212 | $this->get('/api/videos/'.$video->id.'/dislikes')->seeJsonContains($dataUpdate)->seeStatusCode(200); |
||
|
0 ignored issues
–
show
The property
id does not exist on object<App\Video>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 213 | } |
||
| 214 | } |
||
| 215 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: