Skip to content
This repository
Browse code

Github: Fix PHP system notices

- Undefined index: hub_app_access_token in api_uri()
  ==> added isset() check
- Undefined property: stdClass::$id in json_commit_changeset()
  ==> use 'sha' instead of 'id'
  • Loading branch information...
commit 04d4348f5b9b5d2d6c3269d744ea2cfde21e3fef 1 parent 39b3ca8
Damien Regad dregad authored

Showing 1 changed file with 6 additions and 4 deletions. Show diff stats Hide diff stats

  1. +6 4 SourceGithub/SourceGithub.php
10 SourceGithub/SourceGithub.php
@@ -170,9 +170,11 @@ public function update_repo( $p_repo ) {
170 170 private function api_uri( $p_repo, $p_path ) {
171 171 $t_uri = 'https://api.github.com/' . $p_path;
172 172
173   - $t_access_token = $p_repo->info['hub_app_access_token'];
174   - if ( !is_blank( $t_access_token ) ) {
175   - $t_uri .= '?access_token=' . $t_access_token;
  173 + if( isset( $p_repo->info['hub_app_access_token'] ) ) {
  174 + $t_access_token = $p_repo->info['hub_app_access_token'];
  175 + if ( !is_blank( $t_access_token ) ) {
  176 + $t_uri .= '?access_token=' . $t_access_token;
  177 + }
176 178 }
177 179
178 180 return $t_uri;
@@ -349,7 +351,7 @@ public function import_commits( $p_repo, $p_commit_ids, $p_branch='' ) {
349 351
350 352 private function json_commit_changeset( $p_repo, $p_json, $p_branch='' ) {
351 353
352   - echo "processing $p_json->id ... ";
  354 + echo "processing $p_json->sha ... ";
353 355 if ( !SourceChangeset::exists( $p_repo->id, $p_json->sha ) ) {
354 356 $t_parents = array();
355 357 foreach( $p_json->parents as $t_parent ) {

0 comments on commit 04d4348

Please sign in to comment.
Something went wrong with that request. Please try again.