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

TOPIC:

PHP 8 Compatibitility 24 Mar 2022 03:03 #15930

There are going to be a few PHP 8 incompatibilties - so this is probably the place to note them down.
Please add to this list if you find any ... JCook is not being developed anymore - so we need to help each other to keep our older websites running.

If you upgrade to PHP 8 and your whole website goes down... its is probably line 384 in libraries/jdom.php (which is loaded for eevry page).

If you swicth on the Joomla Degug mode, you will see this error...
"count(): Argument #1 ($value) must be of type Countable|array, null given"
This is because a emplty variable, a non-array, is being used with the count function.

In libraries/jdom edit file jdom.php line 384

Change
else if (($i !== null) && (count($args) > $i))

to
else if ($i !== null)
Just call me Chris :)

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

Last edit: by organicwebs.

PHP 8 Compatibitility 24 Mar 2022 03:14 #15931

Now, after this first hurdle... when you go to create a New item, you'll get the same error. This is another bug in the item controller.

In /public_html/administrator/components/com_yourcomponent/classes/controller/item.php Line 240

Change:
if (!count($cid))

To
if (empty($cid))
Just call me Chris :)
The following user(s) said Thank You: jonathanbell

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

PHP 8 Compatibitility 30 May 2022 12:55 #15940

Good work :)

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

PHP 8 Compatibitility 04 Jan 2023 10:31 #15944

  • liubov
  • liubov's Avatar
  • Offline
  • Elite Member
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 279
  • Thank you received: 36
Hi Chris,
Thanks a lot for this.
I've also a warning (error report : Dev) in the next line 385.
Did you change anything, or never mind ?
if ($args[$i] !== null)
Warning: Trying to access array offset on value of type null in /home2/user_xxx/public_html/my_site/libraries/jdom/dom.php on line 385
change to
if (!empty($args[$i]) )

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

Last edit: by liubov.

PHP 8 Compatibitility 04 Jan 2023 17:10 #15945

  • liubov
  • liubov's Avatar
  • Offline
  • Elite Member
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 279
  • Thank you received: 36
To be continue...
Please find below a few code corrections to upgrade PHP8 version with your J-Cook component:

libraries/jdom/dom.php:384
else if ($i !== null) 
        if (!empty($args[$i]) )

administrator/components/com_mycomponent/classes/controller/item.php:240
if (empty($cid))

administrator/components/com_mycomponent/classes/model/list.php:328
protected function belongsToMany($name, $foreignModelClass, $localKey, $foreignKey, $pivot, $pivotLocalKey, $pivotForeignKey, $selectFields = array(), $raw = false)

administrator/components/com_mycomponent/helpers/menu.php:61
public static function addSubmenu($name, $view, $layout)

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

Last edit: by liubov.
  • Page:
  • 1
Time to create page: 0.117 seconds

Awards for the best Joomla app. This product is gonna win an award for this amazing job. Cook Self Service is the the best application from all over the Joomla universe ! It brings Joomla to a professional level really advanced for developers. It is a real fun to develop with it. The ACL part and security checks implementation are just... so much hours saved. I can now concentrate myself more on the design part and the creative works. Thank you so much. Guys I offer you all my congratulation ! Keep up the works because Joomla is needing it to increase the quality of extensions availables on the JED. I also learned a lot because I can see how to code at the proper place and I found all my answers reading the forum.
lack_hanson (JED)
          

Get Started