com web/master: make sure that the variables used below are properly initialized: github-webhook.php

From: Date: Fri, 01 Aug 2014 13:27:52 +0000
Subject: com web/master: make sure that the variables used below are properly initialized: github-webhook.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-19604@lists.php.net to get a copy of this message
Commit: 17134ef267302ca9605d72ad804259a48366a7d3 Author: kovacs.ferenc <kovacs.ferenc@ustream.tv> Fri, 1 Aug 2014 15:27:52 +0200 Parents: f006fcfc79247fa060e6e72b5f35b68c3ebb6093 Branches: master Link: http://git.php.net/?p=web/master.git;a=commitdiff;h=17134ef267302ca9605d72ad804259a48366a7d3 Log: make sure that the variables used below are properly initialized Changed paths: M github-webhook.php Diff: diff --git a/github-webhook.php b/github-webhook.php index 7b7391d..3d2e77a 100644 --- a/github-webhook.php +++ b/github-webhook.php @@ -50,16 +50,18 @@ if (!verify_signature($body)) { exit; } +$PR = $payload->pull_request; +$action = $payload->action; +$payload = json_decode($body); +$htmlUrl = $PR->html_url; +$repoName = $PR->base->repo->name; +$description = $PR->body; + switch ($_SERVER['HTTP_X_GITHUB_EVENT']) { case 'ping': break; case 'pull_request': - $payload = json_decode($body); - $action = $payload->action; - $PR = $payload->pull_request; $mergeable = $PR->mergeable; - $htmlUrl = $PR->html_url; - $description = $PR->body; $to = get_repo_email($CONFIG["repos"], $repoName); $subject = prep_title($action, $PR, $PR->base); @@ -74,9 +76,6 @@ switch ($_SERVER['HTTP_X_GITHUB_EVENT']) { break; case 'pull_request_review_comment': - $payload = json_decode($body); - $action = $payload->action; - $PR = $payload->pull_request; $username = $payload->user->login; $comment = $payload->comment->body;

« previous php.webmaster (#19604) next »