Hey,

this is a followup to #2473717: Add support for per-bundle view modes in the rendered entity processor. I stripped out this issue from my patch there, as the two issues there are unrelated to each other.

Right now this prevents nodes with "RenderedItem" processor enabled to be saved. I think this justifies "Major" priority.

Patch is simple enough...

Comments

ChristianAdamski created an issue. See original summary.

christianadamski’s picture

StatusFileSize
new711 bytes

Here is the patch. Instead of casting to string, I use the __toString(). Not sure if there is actually any difference or preference to that.

Status: Needs review » Needs work

The last submitted patch, 2: 2557723-1-cast_SafeString_to_string.patch, failed testing.

christianadamski’s picture

Status: Needs work » Needs review
StatusFileSize
new748 bytes

Rerolling. Went back to directly casting to (string) and instead checking for FALSE/empty.

Status: Needs review » Needs work

The last submitted patch, 4: 2557723-2-cast_SafeString_to_string.patch, failed testing.

christianadamski’s picture

For the tests to succeed, patch in #2473717: Add support for per-bundle view modes in the rendered entity processor is required as well.

Status: Needs work » Needs review
drunken monkey’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Looks good, thanks!
Could you maybe also add a test for this to the RenderedItemTest class? A small type check in testPreprocessIndexItems() should suffice.

Right now this prevents nodes with "RenderedItem" processor enabled to be saved.

What do you mean with that? Does it prevent the nodes from being indexed, or the index from being saved, or … ? And where does it actually fail?

christianadamski’s picture

At least for us here, saving any node actually resulted in a PHP-Error, because Unicode::truncateBytes or something like that failed hard. Expected a string and got an object.

The reason this isn't triggered in the test, is that the viewmodes that should be set up in the config used in the Test are not used. Therefore preprocess() skips the critical parts in code.

I'm looking into this.

christianadamski’s picture

The issue I described actually does not occure during the preprocessing, but during indexing. There the SafeString value is used that was set during preprocessing.

I'll attach a patch that simply calls for indexItems at the end of the preproccess test. At least locally here, this causes the tests not only to fail, but to get stuck. I do not know enough about the Test Framework to proceed here. I do not know how to handle the testing itself failing.

christianadamski’s picture

Okay, so that actually causes a completely different error that is most likely caused by calling indexItems in an incorrect way.

I don't know enough here. To correctly cover this issue in a test, you would have to make sure, that preprocessed items later can be correctly indexed as well. So you would need to have a test that does both, using a processor to handle items and than trigger the indexing.

I did not find a test doing that to copy from :(

drunken monkey’s picture

Let's try it like this …

The last submitted patch, 12: 2557723-12--rendered_item_processor_safe_string_object.patch, failed testing.

Status: Needs review » Needs work
drunken monkey’s picture

Status: Needs work » Needs review
StatusFileSize
new1.72 KB

Split the IntegrationTest changes into #2564853: Test enabling all processors and indexing.

drunken monkey’s picture

Status: Needs review » Fixed
Issue tags: -Needs tests

Committed.
Thanks again!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.