processwire-issues icon indicating copy to clipboard operation
processwire-issues copied to clipboard

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

Open lparikka opened this issue 1 year ago • 2 comments

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

  • ProcessWire version: 3.0.237
  • (Optional) Any 3rd party modules that are installed and could be related to the issue: PagePathHistory version 0.0.8

lparikka avatar May 06 '24 11:05 lparikka

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;

matjazpotocnik avatar May 12 '24 08:05 matjazpotocnik