Page MenuHomePhabricator

php 8.1 deprecated error for forms with page name formula and empty fields
Closed, ResolvedPublicBUG REPORT

Description

It seems that when a form uses a page name formula, all fields are parsed in PF_FormPrinter around line 1300, i.e. including those that are not part of the formula. If one of such fields is null, the deprecation error is thrown.

Steps to replicate the issue (include links if applicable):

  • create the form w/ wikitext below
  • open the form via /wiki/Special:FormEdit/myform
  • save the form without entering any information
<noinclude>Form:Myform</noinclude>
<includeonly>
{{{info|create title=bla|edit title=bla|page name=<myform[name]> <unique number>}}}
{{{field|name|input type=textarea}}}
{{{field|description|input type=textarea}}}
{{{end template}}}
</includeonly>

What happens?:
Deprecated: str_ireplace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in mediawiki/extensions/PageForms/includes/PF_FormPrinter.php on line 1300

Software version (skip for WMF-hosted wikis like Wikipedia):
PHP 8.1.27
MW 1.39.6
PageForms 0b9a543c85934ab33d952aaa9cea93be60539248

Event Timeline

Schtom renamed this task from deprecated error for forms with page name formula and empty fields to php 8.1 deprecated error for forms with page name formula and empty fields.Mar 7 2024, 11:20 AM
Schtom updated the task description. (Show Details)

Change 1009336 had a related patch set uploaded (by Yaron Koren; author: Yaron Koren):

[mediawiki/extensions/PageForms@master] PHP 8 fix for str_ireplace()

https://gerrit.wikimedia.org/r/1009336

Change 1009336 merged by jenkins-bot:

[mediawiki/extensions/PageForms@master] PHP 8 fix for str_ireplace()

https://gerrit.wikimedia.org/r/1009336

Yaron_Koren claimed this task.
Yaron_Koren subscribed.

I assume this is fixed now. Thanks for reporting it!