?
avatar Razzo1987
Razzo1987
4 Jun 2020

Steps to reproduce the issue

Create an article with an Intro Image, without Caption
View the font-end

Expected result

NO warning

Actual result

Warn about image_intro_caption

System information (as much as possible)

Joomla 4.0 Beta 1

Additional comments

In /layouts/joomla/content/intro_image.php the cose is:

		<?php if ($images->image_intro_caption !== '') : ?>
			<figcaption class="caption"><?php echo htmlspecialchars($images->image_intro_caption, ENT_COMPAT, 'UTF-8'); ?></figcaption>
		<?php endif; ?>

I suggest change the code with:

		<?php if (!empty($images->image_intro_caption)) : ?>
			<figcaption class="caption"><?php echo htmlspecialchars($images->image_intro_caption, ENT_COMPAT, 'UTF-8'); ?></figcaption>
		<?php endif; ?>

REF: #20503 (comment)
@infograf768

avatar Razzo1987 Razzo1987 - open - 4 Jun 2020
avatar joomla-cms-bot joomla-cms-bot - change - 4 Jun 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 4 Jun 2020
avatar richard67 richard67 - change - 4 Jun 2020
The description was changed
avatar richard67 richard67 - edited - 4 Jun 2020
avatar richard67
richard67 - comment - 4 Jun 2020

@infograf768 I think @Razzo1987 is right here, and both changes from your PR #20503 should be modified from if ($images->image_fulltext_caption !== '') to if (!empty($images->image_intro_caption)).

As as I understand the type safe comparison !==, it is true if the values or the data types are different. As null is a separate data type in PHP, this would only result in true if the value is an empty string, but not if the value is null. But !empty() covers both, not null and not empty string.

avatar richard67
richard67 - comment - 4 Jun 2020

@infograf768 Do you wanna make a new PR?

avatar infograf768
infograf768 - comment - 5 Jun 2020

Please do. ;)

avatar richard67
richard67 - comment - 5 Jun 2020

I don't have time before late evening today or even tomorrow.

avatar infograf768
infograf768 - comment - 5 Jun 2020

@SharkyKZ
The code was done this way after your suggestion:
#20503 (comment)

Quid?

Also, I can't confirm the error at all

avatar richard67
richard67 - comment - 5 Jun 2020

I haven't tested yet if I can confirm the issue.

avatar infograf768
infograf768 - comment - 5 Jun 2020

Screen Shot 2020-06-05 at 09 04 40

Screen Shot 2020-06-05 at 09 08 21

Screen Shot 2020-06-05 at 09 09 14

avatar SharkyKZ
SharkyKZ - comment - 5 Jun 2020

My guess this occurs when creating articles programmatically (e.g. using the API) and not providing some fields. I guess we can fix this. But then there's more places like this, e.g. URLs in articles.

avatar richard67
richard67 - comment - 5 Jun 2020

@SharkyKZ Sounds reasonable. Could you make a PR?

avatar infograf768
infograf768 - comment - 5 Jun 2020

API and I are long time enemies. Can't help here.
Some one has to test using API.

avatar richard67
richard67 - comment - 5 Jun 2020

With API testing I am a bit familiar meanwhile, so if someone makes a PR I can test later tonight or tomorrow.

avatar Razzo1987
Razzo1987 - comment - 5 Jun 2020

Yes, I have created the article with API

avatar alikon
alikon - comment - 5 Jun 2020

with or without #29020 ?
asking for a friend of mine ?

avatar PhilETaylor
PhilETaylor - comment - 8 Jun 2020

You can replicate this with the Testing Data in Joomla 4 - see the following for instructions #29507

avatar SharkyKZ
SharkyKZ - comment - 8 Jun 2020

Please test PR #29513.

avatar SharkyKZ SharkyKZ - change - 8 Jun 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-06-08 20:13:40
Closed_By SharkyKZ
avatar SharkyKZ SharkyKZ - close - 8 Jun 2020

Add a Comment

Login with GitHub to post a comment