Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Deprecation notice with PHP 8.5 (txp_sandbox): Using null as an array offset is deprecated #2033

@jools-r

Description

@jools-r

Textpattern version: 4.9-dev

Web server vendor and version: Laravel valet (nginx, local)

Database server vendor and version: MySQL 8.4

PHP version: 8.5.0

Operating system: MacOS

Details

When outputting a custom_field in conjunction with glz_custom_fields, I'm getting the following notice:

Tag error: <custom::field name="fieldname" escape="lower" /> ->  8192: Using null as an array offset is deprecated, use an empty string instead Issue detected while parsing form None on page ateam-home
textpattern/publish/taghandlers.php:2764 txp_sandbox()
textpattern/plugins/glz_custom_fields/glz_custom_fields.php:1144 custom_field()
glz_custom_field()
textpattern/vendors/Textpattern/Tag/Registry.php:140 call_user_func()
textpattern/lib/txplib_publish.php:540 Textpattern\Tag\Registry->process()
textpattern/lib/txplib_publish.php:429 processTags()
textpattern/publish/taghandlers.php:3059 parse()
variable()
textpattern/vendors/Textpattern/Tag/Registry.php:140 call_user_func()
textpattern/lib/txplib_publish.php:540 Textpattern\Tag\Registry->process()

The function glz_custom_field just optionally outputs a custom field's title if set in glz_cf and otherwise passes the attributes wholesale on to custom_field(). The notice is raised in txp_sandbox() function in taghandlers. Setting $thing = '' in the txp_sandbox function silences the notice but impacts on other tags that pass a $thing like body and excerpt.

Adding , $thing = '') to the end of the call to txp_sandbox on

return $escape === null ? txpspecialchars($thisarticle[$name]) : txp_sandbox(array('id' => null, 'field' => $name) + $atts);
would seem to resolve it.

Is that a reasonable solution or does that have other implications for the cf-branch or the other discussion we had about possible using custom_field as a container function for iterating over its contents?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions