Welcome, Guest
Username: Password: Remember me

TOPIC: [FIXED] Builder version VS PHP Version

J-Cook builder version VS PHP Version 01 May 2017 12:51 #15083

  • Sebiiiii
  • Sebiiiii's Avatar
  • Offline
  • New Member
  • Posts: 17
  • Thank you received: 2
  • Karma: 1
Hi there !

Is there a place where I can find wich version of builder works with witch version of php ?

The server my client use is PHP 5.3 only, and I have issues in back end. On dev server it's PHP 5.5 and above, and no issue.

I think maybe it is php version who sucks.
Fatal error: Class 'VoyagesClassFormField' not found in /(...)/administrator/components/com_voyages/models/fields/cksearch.php on line 34
Fatal error: Class 'VoyagesClassFormField' not found in /(...)/administrator/components/com_voyages/models/fields/cksort.php on line 34

Thanks !
Last Edit: 01 May 2017 12:52 by Sebiiiii.
The administrator has disabled public write access.

J-Cook builder version VS PHP Version 02 May 2017 09:39 #15084

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
This is a problem with the loader. Previous versions of PHP do not support the registering / discovering of php classes.
In such case, simply for the loader and register manually the missing class files.

Is it a problem from your component, or from the menu page back-end config ?
Coding is now a piece of cake
The administrator has disabled public write access.

J-Cook builder version VS PHP Version 02 May 2017 10:04 #15085

  • Sebiiiii
  • Sebiiiii's Avatar
  • Offline
  • New Member
  • Posts: 17
  • Thank you received: 2
  • Karma: 1
When I go to
administrator/index.php?option=com_voyages
menu appears well.
But when I click on a view
administrator/index.php?option=com_voyages&view=voyages&layout=default
there is an error.
The administrator has disabled public write access.

J-Cook builder version VS PHP Version 02 May 2017 10:20 #15086

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
It works for me, but I am in PHP 5.5

Then it is more difficult for me to debug it.
Here some hints :

1. Fork your main helper (because the loader is not forkable)
2. On the top of the file, add this line :
JLoader::register('VoyagesClassFormField', JPATH_ADMIN_VOYAGES ."/classes/form/field.php", true);

And tell me if it works.

Otherwise, you can use this code :
require_once(JPATH_ADMIN_VOYAGES ."/classes/form/field.php");

The second one is more brutal because it forces to load into memory even if it is not used. It is recommended to use the first method for memory optimisation.
Hope it helps.
Coding is now a piece of cake
The administrator has disabled public write access.

J-Cook builder version VS PHP Version 02 May 2017 10:22 #15087

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
If you encounter other loader problems for other files, then apply the same strategy forcing the loading of the files.

I think it is only related to the "discovery" function. The class "registering" should work.
Coding is now a piece of cake
The administrator has disabled public write access.

J-Cook builder version VS PHP Version 02 May 2017 10:33 #15088

  • Sebiiiii
  • Sebiiiii's Avatar
  • Offline
  • New Member
  • Posts: 17
  • Thank you received: 2
  • Karma: 1
Thanks for your help.

With both, Page partialy display, but another error appears :
Parse error: syntax error, unexpected '[', expecting ']' in(...)/administrator/components/com_voyages/helpers/file.php on line 2113

But perhaps it is because file is missing.
Last Edit: 02 May 2017 10:34 by Sebiiiii.
The administrator has disabled public write access.

J-Cook builder version VS PHP Version 02 May 2017 10:51 #15089

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
This is interresting to know this new one, because another user had it once but I cannot reproduce it.
Same, this is the PHP version which is responsable.

First of all, try to decompose the code in few lines in order to find where the error is.
Then if you can tell me more, I will be able to do the fix (very easy to change some lines of code)
The source code is absolutely correct, but for previous versions of PHP it lacks.
Sometimes PHP needs a temporary var. For instance PHP refuse :
if (empty(myFunction())){}...
It should be
$result = myFunction();
if (empty($result)){}...

Just as an example to decompose.
I don't know how to fix this one because I can't raise the issue.

If you sort this out, let's share the solution here.

In definitive, if really nothing work, just fork the concerned function, and bypass the buggy code.
Because this function is not used yet by your component. It is about the images treatement for advanced grafical filters. It is a preparation for future feature.
At the moment, the code is useless for you.
Coding is now a piece of cake
The administrator has disabled public write access.

J-Cook builder version VS PHP Version 02 May 2017 12:04 #15090

  • Sebiiiii
  • Sebiiiii's Avatar
  • Offline
  • New Member
  • Posts: 17
  • Thank you received: 2
  • Karma: 1
In helpers/file.php on line 2113, there is
$value = $value[array_keys($value)[0]];
If I replace it by
$value = $value[array_keys($value)];
it worked in PHP 5.3. Don't tested in 5.5 for now.
The administrator has disabled public write access.

J-Cook builder version VS PHP Version 02 May 2017 17:44 #15094

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
No. Don't do that.

The source code is correct.
If array_keys() do not return an array, then that's the problem and you might try to manage this possibilty.
It may work, because anyway if you are not using the image filters, you not gonna see any change.

In definitive, try
$keys = array_keys($value);
if (!is_array($keys))
    $keys = array(0);

$value = $value[$keys[0]];
Coding is now a piece of cake
The administrator has disabled public write access.

J-Cook builder version VS PHP Version 02 May 2017 20:27 #15096

  • Sebiiiii
  • Sebiiiii's Avatar
  • Offline
  • New Member
  • Posts: 17
  • Thank you received: 2
  • Karma: 1
ok, the code works in both php versions.

Thanks a lot !
Forked for future versions
Last Edit: 02 May 2017 20:29 by Sebiiiii.
The administrator has disabled public write access.

J-Cook builder version VS PHP Version 04 May 2017 10:58 #15112

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
I fixed the code. No need to keep your fork.

Fixed.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: Sebiiiii

J-Cook builder version VS PHP Version 04 May 2017 11:56 #15113

  • Sebiiiii
  • Sebiiiii's Avatar
  • Offline
  • New Member
  • Posts: 17
  • Thank you received: 2
  • Karma: 1
Nice, thanks.
The administrator has disabled public write access.
Time to create page: 0.135 seconds

Get Started