Looks like a line is missing in page_list/controller.php

I have a simple script called ‘_addpage.php’ I run with
concrete/bin/concrete5 c5:exec _addpage.php

In that script I add a bunch of pages, then I loppe thru those pages and add a content block and a page_list block. The content block works fine, but it crashes on the page_list block with the error:

In controller.php line 620:
Undefined array key "ptID"

Line 620 is $args['ptID'] = (int) ($args['ptID']);, but I see no ‘ptID’ in the args array. When I add 'ptID' => 0, to the args list (line 591), it works!

So, either I am missing somethign else, or it appears you have a typo in concrete/blocks/page_list/controller.php

Here is the code that crashes.

for($i = 0; $i < $pct; $i++) {

    $name = '/projects/'.$pagenames[$i][2];
    $parentPage = \Page::getByPath($name);
    print "ADDING BLOCKS TO: ".$name."\n";

    $bt0 = BlockType::getByHandle('content');
    $bt0_data = array('content' => '<p class="display-1" style="text-align: center;">PROJECT: '.$cName.'</p>',);
    $parentPage->addBlock($bt0, "Main", $bt0_data);
    $bt1 = BlockType::getByHandle('page_list');
    $bt1_data = array(
        'num' => 25, // number of results
        'includeName' => true, // include page name
    $parentPage->addBlock($bt1, "Main", $bt1_data );

Hi @ntisithoj - that’s an interesting find - I would report that here to get it reviewed and potentially included in the core: