Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

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

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 !

Please Log in or Create an account to join the conversation.

Last edit: by Sebiiiii.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

Please Log in or Create an account to join the conversation.

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

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.

Please Log in or Create an account to join the conversation.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

Please Log in or Create an account to join the conversation.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

Please Log in or Create an account to join the conversation.

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

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.

Please Log in or Create an account to join the conversation.

Last edit: by Sebiiiii.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

Please Log in or Create an account to join the conversation.

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

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.

Please Log in or Create an account to join the conversation.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

Please Log in or Create an account to join the conversation.

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

ok, the code works in both php versions.

Thanks a lot !
Forked for future versions

Please Log in or Create an account to join the conversation.

Last edit: by Sebiiiii.

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

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

Fixed.
Coding is now a piece of cake
The following user(s) said Thank You: Sebiiiii

Please Log in or Create an account to join the conversation.

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

Nice, thanks.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.073 seconds

A HUGE thank you for all the time and effort you have put into J-Cook it is a timesaver and a training tool all in one
Morgan Leecy - MCSE  

Get Started