]> git.mxchange.org Git - friendica.git/commitdiff
Fix $called_api expecting at least 2 elements in tests
authorHypolite Petovan <mrpetovan@gmail.com>
Sun, 1 Jul 2018 04:16:32 +0000 (00:16 -0400)
committerHypolite Petovan <mrpetovan@gmail.com>
Mon, 2 Jul 2018 11:45:11 +0000 (07:45 -0400)
include/api.php
tests/ApiTest.php

index 6d38be95b76633a6f44052a94adf78aaf39bc987..a9a1800af17cf8772297a13f9460e83b9219163e 100644 (file)
@@ -575,6 +575,7 @@ function api_get_user(App $a, $contact_id = null)
                }
        }
 
+       // $called_api is the API path exploded on / and is expected to have at least 2 elements
        if (is_null($user) && ($a->argc > (count($called_api) - 1)) && (count($called_api) > 0)) {
                $argid = count($called_api);
                list($user, $null) = explode(".", $a->argv[$argid]);
index 4c63af7a91306889725d266075d4f97a9f657f0e..982f5bf11a37ac05355dfa5c5bcb0eac7075d130 100644 (file)
@@ -818,7 +818,7 @@ class ApiTest extends DatabaseTest
        public function testApiGetUserWithCalledApi()
        {
                global $called_api;
-               $called_api = ['api_path'];
+               $called_api = ['api', 'api_path'];
                $this->assertSelfUser(api_get_user($this->app));
        }