Project

General

Profile

Actions

Bug #105341

closed

Unable to hide media resources in page properties (media) if more than one

Added by Dirk Sch. 5 months ago. Updated about 19 hours ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2024-10-18
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
13
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If more than one media resource exists on a page, it is not possible to hide e.g. the second media file.

If you upgrade any existing TYPO3 12 installation to 13 LTS with hidden media resources, the output of files fails with "No file reference (sys_file_reference) was found for given UID: xy".

How to reproduce:

On a fresh TYPO3 13 installation add a page, add 2 media resources in page properties and try to disable the second.
On existing installations set one file resource in table "sys_file_reference" with same pid to hidden,

<f:for each="{images}" as="image">
<f:image image="{image}" />
</f:for>

will fail.


Files

Backend.gif (1.04 MB) Backend.gif Dirk Sch., 2024-10-18 09:20

Related issues 3 (1 open2 closed)

Related to TYPO3 Core - Bug #105677: File reference cannot be hiddenClosed2024-11-22

Actions
Related to TYPO3 Core - Bug #96135: IRRE: Hide Record switch not workAccepted2021-11-29

Actions
Related to TYPO3 Core - Task #103752: Use refindex in RootlineUtility, drop addRootLineFieldsClosed2024-04-28

Actions
Actions #1

Updated by Garvin Hicking 5 months ago

  • Category set to Frontend
  • Status changed from New to Needs Feedback

How exactly do you retrieve the pages.media relations in your frontend?

Actions #2

Updated by Dirk Sch. 5 months ago

TS:
lib.slider = FLUIDTEMPLATE
lib.slider {
file = EXT:my_base/Resources/Private/Templates/Slider.html
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
references{
table = pages
uid.data = page:uid
fieldName = media
data = LEVELMEDIA: -1, slide
}
as = images
}
}
settings {
width = 1920
height = 1200
}
}

Fluid in Slider.html:
<f:for each="{images}" as="image">
<f:image image="{image}" width="1920c" height="700c"/>
</f:for>

Actions #3

Updated by Dirk Sch. 5 months ago

Maybe the desciption is not clear enough. Besides the frontend, it is not possible to hide the pages.media on a fresh install in the backend. 1 file works, if you add a second one, you can not hide that file with the backend.

Actions #4

Updated by Garvin Hicking 5 months ago

  • Category changed from Frontend to FormEngine aka TCEforms
  • Status changed from Needs Feedback to Accepted

These may be two issues actually, I'm not sure yet.

I can reproduce this in v13 somehow. Only when having one invisible item, and then inserting from the popup, and then trying to hide the last item it doesn't work. Even if I enable the first one again, I cannot disable the second.

Only if I switch the order of first and second item and then save, it all becomes togle-able again.

I haven't tried to reproduce the frontend now. This needs further inspecting.

I've set this to "FormEngine" for now, in the hopes that "just" formEngine serializes wrong data into sys_file_reference and this affects both backend and frontend.

Actions #5

Updated by Garvin Hicking 3 months ago

  • Related to Bug #105677: File reference cannot be hidden added
Actions #6

Updated by Garvin Hicking 3 months ago

  • Related to Bug #96135: IRRE: Hide Record switch not work added
Actions #7

Updated by Jacco van der Post about 1 month ago · Edited

I confirm this bug, after upgrade to v13.4.4 all the pages which have for example an hidden image and a non hidden image in the resources tab of the page properties give this error in frontend, even with typoscript which could use this image turned off. Pretty annoying bug.

Actions #8

Updated by Garvin Hicking about 1 month ago

Jacco van der Post wrote in #note-7:

I confirm this bug, after upgrade to v13.4.4

From where did you upgrade from? If it was introduced between 13.4.3 and 13.4.4 that would help to spot an issue much easier.

Actions #9

Updated by Jacco van der Post about 1 month ago · Edited

Garvin Hicking wrote in #note-8:

Jacco van der Post wrote in #note-7:

I confirm this bug, after upgrade to v13.4.4

From where did you upgrade from? If it was introduced between 13.4.3 and 13.4.4 that would help to spot an issue much easier.

It was from 11.5. It's hard to reproduce, sometimes hiding and showing the images again, then saving helps. In the sys_file and sys_file_reference tables the relations seem to be correct. Thanks

Actions #10

Updated by Dirk Sch. about 1 month ago

  • Priority changed from Should have to Must have

You can reproduce it in two ways. Hide on media in the backend (most time not possible) or edit the database to reproduce.

Search UID of multiple media resources with same PID:

SELECT `uid`,`pid` FROM `sys_file_reference` WHERE `deleted` = 0 AND `fieldname`= "media";

in my case:

+-----+-----+
| uid | pid |
+-----+-----+
|  27 |   1 |
|  42 |   1 |
|  43 |   1 |
|  70 |   1 |
|  71 |   1 |
|  72 |   1 |
|  18 |   5 |
| 305 |   5 |
|  88 |   5 |
| 306 |   5 |
|  44 |   7 |
|  87 |   7 |
|  90 |  14 |
|  61 |  14 |
| 124 |  34 |
| 125 |  34 |
| 149 |  34 |
| 150 |  34 |
| 161 |  38 |
| 148 |  38 |
+-----+-----+

Hide one media on one of these pages:

UPDATE `sys_file_reference` SET `hidden` = '1' WHERE `sys_file_reference`.`uid` = 18;

and "BAMM"

No file reference (sys_file_reference) was found for given UID: "18" 

My "workaround" for updates to 13 LTS is something like

UPDATE `sys_file_reference` SET `deleted` = '1' WHERE `hidden` = 1 AND `fieldname`= "media";

and the editors hate me

Actions #11

Updated by Gerrit Code Review about 20 hours ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/88594

Actions #12

Updated by Garvin Hicking about 19 hours ago

  • Status changed from Under Review to Closed

Ok, so I took a deep plunge into this the whole evening.

Turns out the cause of this is, that due to the typoscript config:

data = LEVELMEDIA: -1, slide

the RootlineUtility's resolving of records kicks into effect. This one DOES NOT QUERY LIVE INFORMATION of sys_file_reference!

Instead, due to performance reasons this was refactored in v13 with https://review.typo3.org/c/Packages/TYPO3.CMS/+/83729 - according to the changelog entry in https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.2/Important-103748-ReferenceIndexRebuildRequired.html it is now vital that the refindex is in synch. You probably upgraded or performed tasks to hide file references on the DB level, without updating the reference index first.

So the solution must be to keep the sys_refindex in shape, so that the queries succeed. Rebuilding the refindex should fix this case for you. If you do outside manipulation of sys_file_reference, be sure to adjust the refindex as well.

Due to this I will close this issue here. The remaining issue of not being able to properly hide/enable the file references (https://forge.typo3.org/issues/96135) has a seperate patch pending (https://review.typo3.org/c/Packages/TYPO3.CMS/+/88305) which we will hopefully address properly.

I hope this helps!

Actions #13

Updated by Garvin Hicking about 19 hours ago

  • Related to Task #103752: Use refindex in RootlineUtility, drop addRootLineFields added
Actions

Also available in: Atom PDF