Welcome, Guest
Username: Password: Remember me

TOPIC: Error in helper file.

Error in helper file. 08 Jul 2016 23:26 #14194

  • jonathanbell
  • jonathanbell's Avatar
  • Offline
  • Premium Member
  • Posts: 147
  • Thank you received: 5
  • Karma: 1
Hi, I have just reloaded a component for testing in my test environment and the following error is now occurring..
Parse error: syntax error, unexpected '[', expecting ']' in /home/safereco/public_html/test/administrator/components/com_srrisk/helpers/file.php on line 2115
The administrator has disabled public write access.

Error in helper file. 09 Jul 2016 09:18 #14195

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Syntax look good for me.

can you make a dump of $attribs at line 2096 after the var check
if (!$attribs)
	return;
echo("<pre>"); print_r($attribs); echo("</pre>");

Ouch, many errors with this 2.9.
Remember, in the meanwhile, you still can generate in Legacy 2.8.x

I'll check that, but I can't see on my side, so if you can make a dump.
Coding is now a piece of cake
The administrator has disabled public write access.

Error in helper file. 09 Jul 2016 20:47 #14200

  • jonathanbell
  • jonathanbell's Avatar
  • Offline
  • Premium Member
  • Posts: 147
  • Thank you received: 5
  • Karma: 1
Hi, it works from the base component downloaded from JCook.. I had done a little hack to get this component to talk to another one with shared data on it. The error appears after I had changed the sql calls.

Couldn't get the dump to work. "myfault due to lack of knowlege" but noticed if I took out the [0] from the line , I did not get the error.
The administrator has disabled public write access.

Error in helper file. 10 Jul 2016 18:16 #14201

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
At line 2115, $att is an array.
so
$att[] = "...";
is correct

But it is true, that the whole $attribs structure has changed. It is now an object and this is source of numerous issues in the code. But in your case this shouldn't happen because any shape it would have, you would not be able to raise that error.

In case you mix two components, then JDom can eventually be lost in the different calls of the helper.
I am very interrested to check this closer because I am working on compatibility layer.

In case, you can force JDom to work with your desired component (component Helper required for files).
In your concerned JDom call :
...
'extension' => 'com_xxxx'

It should work.
Coding is now a piece of cake
Last Edit: 10 Jul 2016 18:16 by admin.
The administrator has disabled public write access.

Error in helper file. 08 Aug 2016 04:01 #14379

  • jonathanbell
  • jonathanbell's Avatar
  • Offline
  • Premium Member
  • Posts: 147
  • Thank you received: 5
  • Karma: 1
Hi Chef, just tested a component in sandbox - works fine .. upoaded an image and saved correctly. On my testing site I am still getting.

Parse error: syntax error, unexpected '' in /home/safereco/public_html/test/administrator/components/com_simplysafe/helpers/file.php on line 2114

This comes up on save or save and close. Strange that it works on sandbox.

This is on the latest stable j-cook.. Running on Joomla 3.6.2
Last Edit: 08 Aug 2016 04:33 by jonathanbell. Reason: Just added the joomla a jcook version
The administrator has disabled public write access.

Error in helper file. 08 Aug 2016 09:23 #14380

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Strange.

I downloaded and tested your component in local Joomla 3.6, it works like a charm.
Did you tried on a fresh Joomla install ?
Which PHP version ? Maybe you have a more recent version than me.

The following code (causing the error), is not used for you at the moment, because the images filters are not used yet. It is gonna come in future, but at the moment, you might not use them. Filters are complex because they are flexible structures. This is Joomla coding problem wich forces me to do this weird code.
It will evolve for sure. But at the moment it should work.

Solution : comment/remove all this part :
foreach(get_object_vars($attribs->filters) as $filter => $value)
{
	if (is_object($value))
		$value = JArrayHelper::fromObject($value);

	if (is_array($value))
		$value = $value[array_keys($value)[0]];

	$filters[] = $filter . ($value?':'.$value:'');
}

But I am very curious about it because the code is ok. Maybe a recent version of PHP do not allow that way of coding.
Coding is now a piece of cake
The administrator has disabled public write access.

Error in helper file. 08 Aug 2016 20:40 #14392

  • jonathanbell
  • jonathanbell's Avatar
  • Offline
  • Premium Member
  • Posts: 147
  • Thank you received: 5
  • Karma: 1
Hi chef. Thanks I will check php versipn tonite and let you know.

PHP 5.3.29 was what the test site was on, so not the latest version. I will change the version of PHP to see if that makes any difference.
Last Edit: 09 Aug 2016 04:48 by jonathanbell. Reason: Add PHP version
The administrator has disabled public write access.
Time to create page: 0.095 seconds

Get Started