Commit:    5f50ef481f93a8390b4a2e532514fbe6667adacb
Author:    kovacs.ferenc <[email protected]>         Tue, 10 Jun 2014 
22:00:03 +0200
Parents:   399ecb7fbc24279b0b04b887c99ef08397358e1b
Branches:  master

Link:       
http://git.php.net/?p=web/master.git;a=commitdiff;h=5f50ef481f93a8390b4a2e532514fbe6667adacb

Log:
rename the variable holding the PR description to not collide with the request 
body variable with the same name

Changed paths:
  M  github-webhook.php


Diff:
diff --git a/github-webhook.php b/github-webhook.php
index 8b57684..b7fedda 100644
--- a/github-webhook.php
+++ b/github-webhook.php
@@ -7,9 +7,9 @@ $config = array(
        ),
 );
 
-$body = file_get_contents("php://input");
+$description = file_get_contents("php://input");
 
-if (!verify_signature($body)) {
+if (!verify_signature($description)) {
        header('HTTP/1.1 403 Forbidden');
        exit;
 }
@@ -18,13 +18,13 @@ switch  ($_SERVER['HTTP_X_GITHUB_EVENT']) {
        case 'ping':
                break;
        case 'pull_request':
-               $payload = json_decode($body);
+               $payload = json_decode($description);
                $action = $payload->action;
                $PRNumber = $payload->number;
                $PR = $payload->pull_request;
                $htmlUrl = $PR->html_url;
                $title = $PR->title;
-               $body = $PR->body;
+               $description = $PR->body;
                $repoName = $PR->base->repo->name;
 
                $targetBranch = $PR->base->ref;
@@ -43,9 +43,7 @@ switch  ($_SERVER['HTTP_X_GITHUB_EVENT']) {
                if ($mergeable === false) {
                        $message .= "\r\n\r\nWarning: according to github, the 
Pull Request cannot be merged without manual conflict resolution!";
                }
-               if ($body) {
-                       $message .= sprintf("\r\n\r\nPull Request 
Description:\r\n%s", $body);
-               }
+               $message .= sprintf("\r\n\r\nPull Request Description:\r\n%s", 
$description);
                $headers = "From: [email protected]\r\nContent-Type: text/plain; 
charset=utf-8\r\n";
                mail($to, '=?utf-8?B?'.base64_encode($subject).'?=', $message, 
$headers);
                break;


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to