Skip to content
This repository has been archived by the owner on Dec 30, 2020. It is now read-only.

Pagination doesn't work #12

Closed
AlexeyKosov opened this issue Dec 8, 2015 · 7 comments
Closed

Pagination doesn't work #12

AlexeyKosov opened this issue Dec 8, 2015 · 7 comments

Comments

@AlexeyKosov
Copy link
Contributor

There's a bug in the function:

RequestHelper.php:

public static function createRequestData($data, $sourceUrl = null)
{
    return [
        "source_url" => $sourceUrl,
        "data"       => json_encode($data, JSON_FORCE_OBJECT),
    ];
}

Because of JSON_FORCE_OBJECT, bookmarks are encoded incorrectly:
{"0": "Pz9Nakl5TX...YxNmRjNQ=="}
instead of
["Pz9Nakl5TX...YxNmRjNQ=="]

It makes the option invalid and the first page is always being returned.

@seregazhuk
Copy link
Owner

Wrong request in:

SearchHelper.php

protected static function createSimpleSearchRequest($requestData)
    {
        $dataJson = [
            'module' => [
                "name"    => "SearchPage",
                "options" => $requestData['options'],
            ],
            "options" => $requestData['options'],  // <-- was missed
        ];
        return $dataJson;
    }

I missed one more options param.
Strange, but for pinns search it works fine.

@AlexeyKosov
Copy link
Contributor Author

In my case it didn't work for iterating followers.

@seregazhuk
Copy link
Owner

I see, it didn't work for boards and pinners, only for pins. I'll fix it now.

@seregazhuk
Copy link
Owner

Try it now.

@AlexeyKosov
Copy link
Contributor Author

Looks like it didn't help, bookmarks are still being encoded to JSON object rather than array.
I suppose you shouldn't force converting everything to object (JSON_FORCE_OBJECT) since it breaks the functionality. It'd better to use "context" => new \stdClass() when you need to have an empty object "context": {} in JSON.

@AlexeyKosov AlexeyKosov reopened this Dec 8, 2015
@seregazhuk
Copy link
Owner

Oh, I see. Sorry, I'll fix it soon.

@seregazhuk
Copy link
Owner

I think I have fixed it now)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants