No Code Attached Yet
avatar sergeytolkachyov
sergeytolkachyov
13 Feb 2023

Steps to reproduce the issue

  1. Create dummy module or plugin with your custom field type like
    <field type="blablabla" name="blablabla"/>

  2. Specify addfieldpath attribute for this field in XML manifest
    <field type="blablabla" name="blablabla" addfieldpath="modules/mod_blablabla/fields" />

  3. You shoudn't create a field type file modules/mod_blablabla/fields/blablabla.php

  4. Go to admin panel and try to edit your module.

Expected result

If Joomla Form didn't found a field type php file it shows us a field type text instead. We expect the same result on all PHP versions.

Actual result

With PHP 8.0-8.1 we have an error htmlspecialchars(): Argument #1 ($string) must be of type string, array given

Callstack

svf_premium2_administrator_index_php_option=com_modules view=mo

System information (as much as possible)

Joomla 4.2.7
PHP 8.x+
With PHP 7.4 all is fine

Additional comments

avatar sergeytolkachyov sergeytolkachyov - open - 13 Feb 2023
avatar joomla-cms-bot joomla-cms-bot - change - 13 Feb 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 13 Feb 2023
avatar ReLater
ReLater - comment - 13 Feb 2023

Please test pr #39856

avatar Fedik
Fedik - comment - 13 Feb 2023

I cannot reproduce it.

<field type="fakefield" name="somename" label="Fake field"/>

image

The code fallbacks to the text field without error. You probably have stored non string value, therefore you should create a field for your value type.
It not a joomla issue to me.

avatar ReLater
ReLater - comment - 13 Feb 2023

Can not replicate the issue on Joomla 4.3.0-beta2-dev with a custom old-fashioned module. PR closed.

avatar joomdonation
joomdonation - comment - 13 Feb 2023

That could happens if there are data stored for that field before and then the class which defines that field type is lost for some reasons (the file is deleted or moved to new location for example...).

Having fatal error like this is not right but we should not hide the error either. To me, the right option would be throw an UnexpectedValueException but for now, we could leave it as how it is to void people complains when something suddenly broken in a minor or patch release.

avatar sergeytolkachyov
sergeytolkachyov - comment - 13 Feb 2023

Look: I have a module with subform. In this subform I have a fields with addfieldpath, but this path is not really exists (a component for this field type is not installed). When I save module - I have an error. With php 7.4 I haven't errors, with php 8.x I got error.

Sorry for low video quality - 10 mb limit for filesize.
https://user-images.githubusercontent.com/6236403/218484632-66ae0cad-f12e-4e0c-bc67-2a701f9df7b4.mp4

avatar Fedik
Fedik - comment - 13 Feb 2023

That confirms that it not Joomla issue, you have to ask the extension developer for fix, or install missed component.

With php 7.4 I haven't errors, with php 8.x I got error.

On 7.4 PHP shows warning, and on 8.x throws fatal error for incorect value for htmlspecialchars()

avatar alikon
alikon - comment - 13 Feb 2023

and it should be closed as such
here a major release from php 7 to 8 occurs

avatar alikon alikon - change - 14 Feb 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-02-14 07:26:48
Closed_By alikon
avatar alikon alikon - close - 14 Feb 2023

Add a Comment

Login with GitHub to post a comment