We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Paginator Bug

I think there is a bug with the \Phalcon\Paginator\Adapter\NativeArray.

The ->next property contains the wrong value.

Here is a test case:

<?php
$a = array_fill(0, 25, 'banana');
echo count($a);
$paginator = new \Phalcon\Paginator\Adapter\NativeArray(
    array(
        "data" =>$a,
        "limit"=> 25,
        "page" => 1,      
    )
);  
$test = $paginator->getPaginate();

echo '<pre>';
var_dump($test);
echo '</pre>';
?>

After you run this test should have the following values:

$test->first = 1
$test->next = 1
$test->before = 1
$test->current = 1
$test->last = 2 
$test->total_pages = 2

change the array_fill value from 25 to 30 save and refresh the page. $test->next should be 2. but it is not. it stays at 1.

is this a bug or am i doing something wrong, i am using Phalcon 0.9.0



98.9k

I see you already posted this on Github, so it's ok

https://github.com/phalcon/cphalcon/issues/445