JCB not loading... Returns a "Parse Error" #334

Closed
opened 2018-08-31 19:21:52 +00:00 by raysr01 · 12 comments
raysr01 commented 2018-08-31 19:21:52 +00:00 (Migrated from github.com)

Steps to reproduce the issue

Just installed latest version

Expected result

Component to load

Actual result

Parse error: syntax error, unexpected '.', expecting ')' in ...administrator\components\com_componentbuilder\helpers\componentbuilder.php on line 2339

and the same error on line 2408

System information (as much as possible)

  • OS Name & Version:
  • MySql Version:
  • Apache Version:
  • PHP Version: 5.5.15
  • Joomla Version: 3.8.11
  • JCB Version: 2.9
  • Browser:

Additional comments

The following solved the problem:
Changed line 2339 from this:

	public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = JPATH_SITE . '/images/', $createIfNotSet = true)
	{

Into this:

	public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true)
	{
		if($default == '')
		{
			$default = JPATH_SITE . '/images/';
		}

And on line 2408 from this:

	public static function getFolderPath($type = 'path', $target = 'folderpath', $default = JPATH_SITE . '/images/', $createIfNotSet = true)
	{

Into this:

	public static function getFolderPath($type = 'path', $target = 'folderpath', $default = '', $createIfNotSet = true)
	{
		if($default == '')
		{
			$default = JPATH_SITE . '/images/';
		}
### Steps to reproduce the issue Just installed latest version ### Expected result Component to load ### Actual result Parse error: syntax error, unexpected '.', expecting ')' in ...administrator\components\com_componentbuilder\helpers\componentbuilder.php on line 2339 and the same error on line 2408 ### System information (as much as possible) - OS Name & Version: - MySql Version: - Apache Version: - PHP Version: 5.5.15 - Joomla Version: 3.8.11 - JCB Version: 2.9 - Browser: ### Additional comments **The following solved the problem:** Changed line 2339 from this: ``` public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = JPATH_SITE . '/images/', $createIfNotSet = true) { ``` Into this: ``` public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true) { if($default == '') { $default = JPATH_SITE . '/images/'; } ``` And on line 2408 from this: ``` public static function getFolderPath($type = 'path', $target = 'folderpath', $default = JPATH_SITE . '/images/', $createIfNotSet = true) { ``` Into this: ``` public static function getFolderPath($type = 'path', $target = 'folderpath', $default = '', $createIfNotSet = true) { if($default == '') { $default = JPATH_SITE . '/images/'; } ```

Okay, I will update that, but just that you know. We have moved JCB to PHP 7 and are not testing it in version PHP 5 anymore. So thanks for the headsup, and if you run in to any more issues your are welcome to let us know.

Okay, I will update that, but just that you know. We have moved JCB to PHP 7 and are not testing it in version PHP 5 anymore. So thanks for the headsup, and if you run in to any more issues your are welcome to let us know.
raysr01 commented 2018-09-01 06:20:12 +00:00 (Migrated from github.com)

Thank you for accommodating me. I see you have been working late and have updated it already, thanks. However, the same errors are being returned (it's complaining about the '.'), $default still has to be changed into an empty string in the function variables itself (see in my updates above - line 2339 & 2408... I changed it to: $default = '').

Thank you for accommodating me. I see you have been working late and have updated it already, thanks. However, the same errors are being returned (it's complaining about the '.'), $default still has to be changed into an empty string in the function variables itself (see in my updates above - line 2339 & 2408... I changed it to: $default = '').

Woops missed that :)

Woops missed that :)

I also know that this issue is able to be fixed by making some changes to your PHP settings... if I remember correctly. I think we had this issue before... let me look.....

Hmm I see there was two issues surrounding this...
Issue 190
Issue 187

Also seems like @joomlaserbia had a better solution to the issue... I think I will combine the two 👍 not sure how I missed his last reply.

Please next time help me, by searing the closed issues for past posts surrounding the same issue, and just start commenting on it again.. that way others Googleing can find the answers easier.

I also know that this issue is able to be fixed by making some changes to your PHP settings... if I remember correctly. I think we had this issue before... let me look..... Hmm I see there was two issues surrounding this... [Issue 190](https://github.com/vdm-io/Joomla-Component-Builder/issues/190) [Issue 187](https://github.com/vdm-io/Joomla-Component-Builder/issues/187) Also seems like @joomlaserbia had a better solution to the issue... I think I will combine the two :+1: not sure how I missed his last reply. Please next time help me, by searing the closed issues for past posts surrounding the same issue, and just start commenting on it again.. that way others Googleing can find the answers easier.
raysr01 commented 2018-09-01 08:44:18 +00:00 (Migrated from github.com)

Sure, thanks.

Sure, thanks.

Can you do me a quick favor... can you test this option:

public static function getFolderPath($type = 'path', $target = 'folderpath', ($default = JPATH_SITE . "/images/"), $createIfNotSet = true)

Since I see the $default = '{JPATH_SITE}/images/' is not working.

Can you do me a quick favor... can you test this option: ``` public static function getFolderPath($type = 'path', $target = 'folderpath', ($default = JPATH_SITE . "/images/"), $createIfNotSet = true) ``` Since I see the `$default = '{JPATH_SITE}/images/'` is not working.

O it should look like this instead...

public static function getFolderPath($type = 'path', $target = 'folderpath', $default = (JPATH_SITE . "/images/"), $createIfNotSet = true)
O it should look like this instead... ``` public static function getFolderPath($type = 'path', $target = 'folderpath', $default = (JPATH_SITE . "/images/"), $createIfNotSet = true) ```
raysr01 commented 2018-09-01 09:37:50 +00:00 (Migrated from github.com)

None of those two work.

($default = JPATH_SITE . "/images/")
Returns: Parse error: syntax error, unexpected '(', expecting '&' or variable (T_VARIABLE) in ...

$default = (JPATH_SITE . "/images/")
Returns: Parse error: syntax error, unexpected '(' in ...

This one (of joomlaserbia) however does work:

$default = '{JPATH_SITE}/images/'

None of those two work. ($default = JPATH_SITE . "/images/") **Returns:** Parse error: syntax error, unexpected '(', expecting '&' or variable (T_VARIABLE) in ... $default = (JPATH_SITE . "/images/") **Returns:** Parse error: syntax error, unexpected '(' in ... **This one (of joomlaserbia) however does work:** $default = '{JPATH_SITE}/images/'
raysr01 commented 2018-09-01 09:51:43 +00:00 (Migrated from github.com)

It seems that since it is working for both me and joomlaserbia who at the time was using php 5.6 and I'm using 5.5.15, and it's not working for you being on php 7+, it's best to keep it the way you changed it last night - the way it is now, so it works on all php versions natively (and safely in all future php versions too).

It seems that since it is working for both me and joomlaserbia who at the time was using php 5.6 and I'm using 5.5.15, and it's not working for you being on php 7+, it's best to keep it the way you changed it last night - the way it is now, so it works on all php versions natively (and safely in all future php versions too).
raysr01 commented 2018-09-13 10:30:23 +00:00 (Migrated from github.com)

Update:

I get the same error when compiling:
Parse error: syntax error, unexpected '.', expecting ',' or ';' in ... \administrator\components\com_componentbuilder\helpers\compiler\a_Get.php on line 26

...same error on line 33, 40 and 275

Solution:
On lines 26, 33 and 40...
Changed this:

public $hhh = '#' . '#' . '#';

	/**
	 * The open bracket placeholder
	 * 
	 * @var     string
	 */
	public $bbb = '[' . '[' . '[';

	/**
	 * The close bracket placeholder
	 * 
	 * @var     string
	 */
	public $ddd = ']' . ']' . ']';

Into this:

public $hhh = '###';

	/**
	 * The open bracket placeholder
	 * 
	 * @var     string
	 */
	public $bbb = '[[[';

	/**
	 * The close bracket placeholder
	 * 
	 * @var     string
	 */
	public $ddd = ']]]';

On line 275...
Changed this:

public $langStringTargets = array(
		'Joomla' . '.JText._(',
		'JText:' . ':script(',
		'JText:' . ':_(',
		'JText:' . ':sprintf(',
		'JustTEXT:' . ':_('
	);

Into this:

public $langStringTargets = array(
		'Joomla.JText._(',
		'JText::script(',
		'JText::_(',
		'JText::sprintf(',
		'JustTEXT::_('
	);

Then same error in another file:
Parse error: syntax error, unexpected '.', expecting ')' in ... \administrator\components\com_componentbuilder\helpers\compiler\e_Interpretation.php on line 15678

On line 15678...
Changed this:

public function getInbetweenStrings($str, $start = '#' . '#' . '#', $end = '#' . '#' . '#')

Into this:

public function getInbetweenStrings($str, $start = '###', $end = '###')
**Update:** I get the same error when compiling: `Parse error: syntax error, unexpected '.', expecting ',' or ';' in ... \administrator\components\com_componentbuilder\helpers\compiler\a_Get.php on line 26` ...same error on line 33, 40 and 275 **Solution:** **On lines 26, 33 and 40...** Changed this: ``` public $hhh = '#' . '#' . '#'; /** * The open bracket placeholder * * @var string */ public $bbb = '[' . '[' . '['; /** * The close bracket placeholder * * @var string */ public $ddd = ']' . ']' . ']'; ``` Into this: ``` public $hhh = '###'; /** * The open bracket placeholder * * @var string */ public $bbb = '[[['; /** * The close bracket placeholder * * @var string */ public $ddd = ']]]'; ``` **On line 275...** Changed this: ``` public $langStringTargets = array( 'Joomla' . '.JText._(', 'JText:' . ':script(', 'JText:' . ':_(', 'JText:' . ':sprintf(', 'JustTEXT:' . ':_(' ); ``` Into this: ``` public $langStringTargets = array( 'Joomla.JText._(', 'JText::script(', 'JText::_(', 'JText::sprintf(', 'JustTEXT::_(' ); ``` **Then same error in another file:** `Parse error: syntax error, unexpected '.', expecting ')' in ... \administrator\components\com_componentbuilder\helpers\compiler\e_Interpretation.php on line 15678` **On line 15678...** Changed this: ``` public function getInbetweenStrings($str, $start = '#' . '#' . '#', $end = '#' . '#' . '#') ``` Into this: ``` public function getInbetweenStrings($str, $start = '###', $end = '###') ```

Well there is a separating '#' . '#' . '#' string there because we are moving towards the option of parsing the compiler files when compiling JCB itself (we need that for the language strings and other mind bending future plans), and if those strings are like ### JCB will pick them up and convert them, or try to pull data from them, which is what it already does with other files.

I would suggest you upgrade your php to the latest, or at least 5.6

We simply can't change those strings, and adding them to a method will slow JCB down as they are used extensively across the compiler.

Well there is a separating `'#' . '#' . '#'` string there because we are moving towards the option of parsing the compiler files when compiling JCB itself (we need that for the language strings and other mind bending future plans), and if those strings are like `###` JCB will pick them up and convert them, or try to pull data from them, which is what it already does with other files. I would suggest you upgrade your php to the latest, or at least 5.6 We simply can't change those strings, and adding them to a method will slow JCB down as they are used extensively across the compiler.
raysr01 commented 2018-09-13 11:45:04 +00:00 (Migrated from github.com)

Ok, no prob. I will do the upgrade and see what happens. Thanks. And thank you for this wonderful component, it's a great project and you have done an excellent job of it!

Ok, no prob. I will do the upgrade and see what happens. Thanks. And thank you for this wonderful component, it's a great project and you have done an excellent job of it!
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#334
No description provided.