?
avatar Quy
Quy
7 Feb 2020

Steps to reproduce the issue

Go to System > Site Templates
Click Cassiopeia Details and Files
Edit a file
See PHP error log

Actual result

PHP Notice: Trying to access array offset on value of type null in \administrator\components\com_templates\tmpl\template\default_modal_resize_body.php on line 25

PHP Notice: Trying to access array offset on value of type null in\administrator\components\com_templates\tmpl\template\default_modal_resize_body.php on line 35

avatar Quy Quy - open - 7 Feb 2020
avatar joomla-cms-bot joomla-cms-bot - change - 7 Feb 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 7 Feb 2020
avatar richard67
richard67 - comment - 7 Feb 2020

@Quy When I was reproducing issue #27832 , I did exactly the same what you describe in your steps to reproduce the issue here, but I did not have these entries in PHP error log. And I had error reporting switched to "Development" before. Does that happen with any file you edit? Or only particular?

avatar Quy
Quy - comment - 7 Feb 2020

It could be related to PHP 7.4.1.

avatar richard67
richard67 - comment - 7 Feb 2020

Ah that makes sense, I didn't test with 7.4, only with 7.3 and 7.2.

avatar richard67
richard67 - comment - 7 Feb 2020

But the only array elements I see are $this->image['height'] and $this->image['width']. Could you add some code to dump variable type of $this->image into the log file and check what happens? I'd like to know if it's maybe an object instead of an array. Something like error_log(gettype($this->image))?

avatar richard67
richard67 - comment - 7 Feb 2020

I have 7.4 only on a test domain in web, not locally, so it would be a bit uncomfortable for me to install latest 4.0-dev and test. Would have to clean it up before.

avatar Quy
Quy - comment - 7 Feb 2020

$this->image is null. You can install the nightly build.

avatar richard67
richard67 - comment - 7 Feb 2020

That PHP file is not really well documented.

avatar Quy
Quy - comment - 7 Feb 2020

Tested on 7.3.14 with no errors. Here is the generated code without height/width values. Maybe remove the placeholder attribute?

<input class="form-control" type="number" name="height" placeholder=" px" required>
<input class="form-control" type="number" name="width" placeholder=" px" required>
avatar richard67
richard67 - comment - 7 Feb 2020

@Quy Makes sense, only echo it if not null.

avatar Quy
Quy - comment - 7 Feb 2020

I don't know why the following code is on that page and how to trigger the modal.


		<form action="/administrator/index.php?option=com_templates&amp;task=template.resizeImage&amp;id=204&amp;file=L2luZGV4LnBocA" method="post">
		<div id="resizeModal" role="dialog" tabindex="-1" class="joomla-modal modal fade"  >
	<div class="modal-dialog modal-lg" role="document">
		<div class="modal-content">
			<div class="modal-header">
			<h3 class="modal-title">Resize Image</h3>
				<button type="button" class="close novalidate" data-dismiss="modal" aria-label="Close">
			<span aria-hidden="true">&times;</span>
		</button>
	</div>
<div class="modal-body">
	<div id="template-manager-resize" class="container-fluid">
	<div class="mt-2">
		<div class="col-md-12">
			<div class="control-group">
				<div class="control-label">
					<label for="height">
						Height					</label>
				</div>
				<div class="controls">
					<input class="form-control" type="number" name="height" placeholder=" px" required>
				</div>
			</div>
			<div class="control-group">
				<div class="control-label">
					<label for="width">
						Width					</label>
				</div>
				<div class="controls">
					<input class="form-control" type="number" name="width" placeholder=" px" required>
				</div>
			</div>
		</div>
	</div>
</div>
</div>
<div class="modal-footer">
	<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Resize</button>
</div>
avatar richard67
richard67 - comment - 7 Feb 2020

@Quy Then we are two who don't know that.

avatar Quy
Quy - comment - 7 Feb 2020

Go to images > system >
Click on an image to get crop and resize buttons.

avatar richard67
richard67 - comment - 7 Feb 2020

@Quy I go to edit a picture where you said, I don't get anything in PHP erro log but also can't see any buttons.

avatar Quy
Quy - comment - 7 Feb 2020

Are you using PHP 7.4+? I think I have a fix. There is a logic to enable the resize modal for image type which it is not doing right now.

avatar richard67
richard67 - comment - 7 Feb 2020

PHP 7.2.

avatar Quy
Quy - comment - 7 Feb 2020

I still think it is a PHP 7.4+ issue. I don't get the error with PHP 7.3.14

avatar richard67
richard67 - comment - 7 Feb 2020

And where shall these bloody buttons appear? Maybe I'm just too silly to find them? You have a screenshot?

avatar richard67
richard67 - comment - 7 Feb 2020

aah i have them, was blind, now can see.

avatar richard67
richard67 - comment - 7 Feb 2020

I don't have the issue with 7.2 so yes, it could be a 7.4+ issue.

avatar Quy
Quy - comment - 7 Feb 2020

Please test PR #27851

avatar Quy Quy - change - 7 Feb 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-02-07 22:19:55
Closed_By Quy
avatar Quy Quy - close - 7 Feb 2020

Add a Comment

Login with GitHub to post a comment