Issues (994)

views/blogger/edit-f.php (1 issue)

Labels
Severity
1
<?php
2
3
use JSON\json;
4
5
$class = new GoogleExt\client();
6
$class->auto_login('/auth/google');
7
//exit(json::json($class->getAccessToken()));
8
/**
9
 * @var Google\Client
10
 */
11
$client = $class->custom_client('blogger', '/auth/google');
12
$service = new GoogleExt\blogger($client);
13
14
if (isset($_REQUEST['bid'])) {
15
  $blog = $service->set_blog_id($_REQUEST['bid']);
0 ignored issues
show
Are you sure the assignment to $blog is correct as $service->set_blog_id($_REQUEST['bid']) targeting GoogleExt\blogger::set_blog_id() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
16
}
17
18
if (isset($_REQUEST['update']) && $class->isValid()) {
19
  $blogId = $_REQUEST['blogid'];
20
  $postId = $_REQUEST['postid'];
21
  $mypost = new Google_Service_Blogger_Post();
22
  $mypost->setTitle($_REQUEST['title']);
23
  $mypost->setContent($_REQUEST['body']);
24
  $labels = explode(',', $_REQUEST['label']);
25
  $labels = array_map('trim', $labels);
26
  $mypost->setLabels($labels);
27
  try {
28
    $service->posts->update($blogId, $postId, $mypost);
29
  } catch (Exception $e) {
30
    exit($e->getMessage());
31
  }
32
}
33