customisation-db icon indicating copy to clipboard operation
customisation-db copied to clipboard

PHP Notice "Array to string conversion" on search

Open battye opened this issue 1 year ago • 0 comments

Hi, When phpBB debug is enabled, the search of Titania returns the following PHP Notice.

[phpBB Debug] PHP Notice: in file [ROOT]/phpbb/path_helper.php on line 347: Array to string conversion How to reproduce issue? Go to Titania : https://www.phpbb.com/customise/db/ Select a category : https://www.phpbb.com/customise/db/extensions-36 Enter your keywords on the search inputbox (near to the button "New Contribution") This will return the PHP Notice. The 2 notices are due to the parameters c and version that are set as array in array on controller\search.php on line 277-278 So, when this 2 parameters are handled by the phpbbb\path_helper it fails because $value is an array and not a string value.

Reporter: Skouat Created: 17/May/20 10:15 PM

Comments:

battye added a comment - 31/Jul/20 12:48 PM Thanks Skouat, I've replicated this now. It seems to be more of a pagination issue, because if you click to the second page of the search results it has c=Array in the URL. To replicate it locally results?keywords=scroll&c%5B%5D=1&sc=1 - particularly the c[]=1 part. I'm not really sure why it's sending it as an array (same for version) because I don't know how a user could actually search multiple categories/versions through the UI. Maybe it's as simple as what you suggest, changing the arrays to int. I'm still digging to see if there's any sideeffects from that.

  $versions = [$this->request->variable('versions', '')];
  $categories = [$this->request->variable('c', 0)];

And also search.php:277 as Skouat mentioned earlier. The only references I can find (and there are some in the code) to multi-category or multi-version searching are if SEARCH_IN_RESULTS in search_results.html is true. And I can't find any reference to SEARCH_IN_RESULTS anywhere in the Titania code, so I don't think it will ever be true. There actually is a page for this (/db/find-contribution) but as above, there's no way for a user to access it without going to the URL directly. And even if they did, it wouldn't work beyond page 1 for the c=Array, versions=Array reason described earlier and reported by Skouat. Unless I've missed something where the multi-category search is publicly available, there's three options I see: Fix the SEARCH_IN_RESULTS stuff, adding a new feature in the process I suppose, whereby another search box will be on the CDB search results page which will have a link to the /db/find-contribution - and then we fix the pagination and request code so it can handle multiple IDs in non-array form. Don't fix the SEARCH_IN_RESULTS, but make the /db/find-contribution link available somewhere else, and fix the pagination/request code to handle multiple IDs in non-array form. Remove all references to the /db/find-contribution in the CDB code, and change the pagination/request code to only accept one ID at a time.

Skouat added a comment - 02/Aug/20 5:46 PM and why not merge the db/find-contribution and db/search pages?

battye avatar Sep 23 '23 09:09 battye