processwire / processwire-issues

ProcessWire issue reports.
44 stars 2 forks source link

Problem with PagePathHistory::getPathInfo() returning only the initialized empty content #1916

Open lparikka opened 2 months ago

lparikka commented 2 months ago

Short description of the issue

PagePathHistory modules getPathInfo() does not return any correct answers.

Expected behavior

$p->getPathInfo("/en/about/child-page-example/") should return the information from the page_path_history table, but it does not do that.

Actual behavior

Returns the default initial array with empty values:

array (10)
'id' => 0
'path' => '/en/about/child-page-example'
'language_id' => 0
'templates_id' => 0
'parent_id' => 0
'created' => ''
'status' => 0
'name' => ''
'matchType' => ''
'urlSegmentStr' => ''

Steps to reproduce the issue

$p = $modules->get('PagePathHistory');
$p->getPathInfo("/en/about/child-page-example/")

should return the value that is in the database:

INSERT INTO `page_path_history` (`path`, `pages_id`, `created`, `language_id`)
VALUES
    ('/en/about/child-page-example', 1002, '2024-04-13 16:31:53', 0);

Setup/Environment

matjazpotocnik commented 2 months ago

I've never used this module, but I tried to debug it and found two lines that I had to modify to make it work:

I commented $query->closeCursor(); on line 642 and changed line 649 to read if(!$rowCount || !$query) return $result;