$view->action('test_search') is returning an edit link and NOT the action link

Permalink
Change the title to correctly reflect the issue
HI,
I am having issues with external forms that are not working as expected.
I have been struggling to get the external forms to work, so to make it simple I have made this as simple as possible I have added a new page into the site using the elemental theme and the supplied test form with the external forms block. When I test this I would expect the path called to be
/domain name/testform/test_search/subscribe instead I get

/domian name/ccm/system/block/action/edit/14340/Sub-Header/7905/test_search
which fails to find the page
I have repeated this test on another 8.50 site that was recently installed and it works ok.
The question is what is going wrong?

Thanks
Martyn

FaganSystems
 
FaganSystems replied on at Permalink Reply
FaganSystems
OK So I have continued digging and found this.
$action = $this->getAction();
                if ($action === 'view' || strpos($action, 'action_') === 0) {
                    $c = Page::getCurrentPage();
                    if (is_object($b) && is_object($c)) {
                        $arguments = func_get_args();
                        $arguments[] = $b->getBlockID();
                        array_unshift($arguments, $c);
                        return call_user_func_array(array('\URL', 'page'), $arguments);
                    }
                } else {
                    /* Call to action() is going through here, when it should be going through the first part of the if()*/
                    $c = $this->getCollectionObject();
                    $arguments = array_merge(array('/ccm/system/block/action/edit',
                        $c->getCollectionID(),
                        urlencode($this->getAreaObject()->getAreaHandle()),


Can anyone explain what sets the action to view?

Slowly tearing hair out now...
Martyn
FaganSystems replied on at Permalink Reply
FaganSystems
Question: Should this thread be in Slack or another forum group?

I didn't mention this before the version is 8.50, it was a clean install with a 5.6.3.5 site migrated onto it.
Testing has been done on both Apache2 and Nginx. PHP is 7.3
I have a comparison site running 8.51 this is a clean build with no changes running on Nginx with fpm running php7.3.
Question is this a functional issue with 8.50 and php 7.3?

Progress
I have spent some time debugging this and will continue to try to resolve the issue, but if anyone has any ideas or questions they would be most welcome.

What I have found is this:-
The problem is affecting this function in the BlockController. I have found that the Abstractcontroller does correctly set Action but it would seem that the getActionURL function is being called before the Abstract Controller writes the value of Action.

public function getActionURL($task)
    {
        try {
            if (is_object($this->block)) {
                if (is_object($this->block->getProxyBlock())) {
                    $b = $this->block->getProxyBlock();
                } else {
                    $b = $this->block;
                }
                $action = $this->getAction();
                if ($action === 'view' || strpos($action, 'action_') === 0) {
                    $c = Page::getCurrentPage();
                    if (is_object($b) && is_object($c)) {
                        $arguments = func_get_args();
                        $arguments[] = $b->getBlockID();

Right now my options for understanding and fixing this are running out. I will try building a test site running 8.51 on php7.3 and report back on what I find.

Thanks
Martyn
FaganSystems replied on at Permalink Best Answer Reply
FaganSystems
This was finally resolved by updating to 8.5.1

Is there a known issue with 8.50?

Thanks
Martyn
guythomas replied on at Permalink Reply
guythomas
edit-- I had a block which was a modified duplicate of the original external_forms block from an earlier version. I had to update my block controller with the fix here:https://github.com/concrete5/concrete5/commit/7d1bfe1ebae1f5b52b39f3...

All is well.