Add new field to xml form, type = subform. Providing your component is ready to be used, go edit an existing item or make a new one, fill the data and hit save (in admin).
The item is saved with success message.
On linux the error is thrown instead of saving the item. While on Win10 it works fine. No errors and the item in the DB looks like it's supposed to be (on UI in the form it looks correct as well).
Joomla 4.2.6
PHP 8.0.28
Ubuntu & win10 (openserver)
I thied to var_dump the code a bit and found out that the error happens because PHP cannot load the file, and I get the error :
include(../www/libraries/vendor/composer/../../../libraries/src/Form/Rule/SubformRule.php): Failed to open stream: No such file or directory in XXX
Thing is - the actual file is SubFormRule.php
with uppsercase F and it causes the error on linux while on win10, for example, it's not important because the routes are not case-sensitive.
I tried to fix it myself and in fact it worked: in libraries/src/Form/Formfield.php
line 1193 replace $rule = FormHelper::loadRuleType('Subform');
with $rule = FormHelper::loadRuleType('SubForm');
and the error is gone on linux
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
P.S.: You should update to 4.3.1 (or soon 4.3.2). 4.2.6 is outdated. When you do that update in the right way using the Joomla Update Component, the file should be renamed by that procedure in script.php to which I have linked in my previous comment, and so the issue fixed.
Please check and confirm. Thanks in advance.
Labels |
Added:
Information Required
|
@richard67 hmm... The weird thing is - I updated the website to 4.3.1 and still the filename didn't change, hence the issue is still present. However, I rolled back, renamed the file to SubformRule.php
and did the update. The result: filename didn't change, it remained with lowercase F (and subforms work correct now).
Looks like there's an issue with Windows environment itself.
In regards to your questions about updates: I have the website locally, I do the updates there using Joomla Update component with direct update.i'm not using upload & update option). After the update is done, the branch is deployed to staging environment. So, since Joomla 2.5x I've been using this way of updating the app. It is this only time where I faced the issue: when upgrading from joomla 3.x latest to 4.2.6. And the issue was still present when migrating from 4.2.6 to 4.3.1 ...
@dmitripanteen Anyway, the right name is SubformRule.php
, please trust me.
Maybe you have run into following problem:
When you are trying to rename that file in a local Windows environment, and the old and the new name only differ in casing, i.e. rename from "SubFormRule.php" to "SubformRule.php" or vice versa, then the Windows Explorer will show you the new name. But the filesystem still uses the old name. You will not notice that unless using e.g. PHP code to read the directory.
Therefore, if you want to be sure that it is really renamed on the file system on Windows, rename it first to a name which is really different, regardless of the case, and then rename it to the final new name. I.e. first rename "SubFormRule.php" to "SubFormRule_temp.php" and then rename "SubFormRule_temp.php" to "SubformRule.php".
And maybe you also have run into following problem in addition:
When you do a migration or update of Joomla on a local Windows environment and then copy that to your remote Linux server, you should not copy the content of the cache and tmp directories. See the comment here: #40226 (comment)
Now let's say you have both problems in combination, you have a file which still has the wrong name on the Windows filesystem, copy that to the Linux server, and you have a file "administrator\cache\autoload_psr4.php" which has been created with the update of the CMS on your Windows environment, and this has the wrong file name, and now you copy that to your Linux, then the autoloader will use the wrong file name, and because you have copied the file with the wrong name it will work, and as soon as you change it to the right name it will stop to work.
Therefore the autoloader file as other cache stuff shall not be copied between the 2 environments. The autoloader file will be recreated with the next page load if it doesn't exist.
Can you check if on the Linux server the file has the right name SubformRule.php
? If not, please rename it on the Linux server. Then delete the "administrator\cache\autoload_psr4.php" file and reload (or load) the page in the browser. Does it work now?
@richard67 hah, the file is with uppercase F, for sure. I'm not using explorer, I see it in PHPStorm as well as when running php commans like scandir()
.
Cache, tmp and autoload directories/files are not a part of the repository, so they don't get deployed to any environment.
It's just the thing that filename wasn't updated when doing a Joomla update (twice). This could be just my issue with local windows environment.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-09-01 13:57:06 |
Closed_By | ⇒ | brianteeman |
I am going to close this as there is nothing to do
@dmitripanteen It seems something went wrong with an update in past because the right file name is
SubformRule.php
, and the file should have been renamed on update with the method here: https://github.com/joomla/joomla-cms/blob/4.3-dev/administrator/components/com_admin/script.php#L8652 . It seems that has not happened.How have you updated in past? Have you always used the Joomla Update component, or have you used other, old methods which are not valid anymore, and have you had problems during a past update?