Keyword

Problems with php 7.3 -> now php 7.4.33

  • Franz Heine
  • Franz Heine's Avatar Topic Author
  • Offline
  • Premium Member
More
5 years 3 months ago #173109 by Franz Heine
Problems with php 7.3 was created by Franz Heine
with php 7.3 i get this error:

Warning: Use of undefined constant com_k2 - assumed 'com_k2' (this will throw an Error in a future version of PHP) in /www/htdocs/w0154391/projekt-rechnung/templates/yoo_stage/layouts/theme.php on line 125

Warning: Use of undefined constant itemlist - assumed 'itemlist' (this will throw an Error in a future version of PHP) in /www/htdocs/w0154391/projekt-rechnung/templates/yoo_stage/layouts/theme.php on line 125

This is my code in the template:


<?php if ($this->count('main-topkategorie') && JRequest::getCmd( 'option' )==com_k2 && JRequest::getCmd( 'view' )==itemlist) : ?>


The reason is, i just want to show this module pos. in the itemlist view.

With php 7.1 is everything fine.

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

More
5 years 3 months ago #173113 by JoomlaWorks
Replied by JoomlaWorks on topic Problems with php 7.3
You need to slightly modify your code and include some quotes, like this:
<?php if ($this->count('main-topkategorie') && JRequest::getCmd( 'option' )=='com_k2' && JRequest::getCmd( 'view' )=='itemlist') : ?>

(I just added the missing single quotes around com_k2 and itemlist)

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Franz Heine
  • Franz Heine's Avatar Topic Author
  • Offline
  • Premium Member
More
5 years 3 months ago - 5 years 3 months ago #173114 by Franz Heine
Replied by Franz Heine on topic Problems with php 7.3
Thx @Fotis. Worked!


Now i received another issue:

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 14 in /www/htdocs/w0154391/projekt-rechnung/components/com_k2/views/item/view.html.php on line 212

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /www/htdocs/w0154391/projekt-rechnung/components/com_k2/views/item/view.html.php on line 213

Thats the code:
$comments[$i]->commentText = preg_replace("/([\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/i", "<a target=\"_blank\" rel=\"nofollow\" href=\"$1\">$1</A>", $comments[$i]->commentText);
$comments[$i]->commentText = preg_replace("/([\w-?&;#~=\.\/]+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?))/i", "<a href=\"mailto:$1\">$1", $comments[$i]->commentText);

Hope youve a solution for thi too.

EDIT: If i comment this area out (#), the notice disappear!!!
Last edit: 5 years 3 months ago by Franz Heine.

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

More
5 years 3 months ago #173117 by JoomlaWorks
Replied by JoomlaWorks on topic Problems with php 7.3
The regular expressions to filter URLs in comments need some updating because how PHP parses these regular expressions was changed in 7.3 (to be stricter). The range error refers to "w-?". I'll make sure to update that in K2 v2.10 coming this month.

In the meantime, I would recommend setting Joomla's error reporting to none (in Global Configuration).

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Franz Heine
  • Franz Heine's Avatar Topic Author
  • Offline
  • Premium Member
More
5 years 3 months ago #173129 by Franz Heine
Replied by Franz Heine on topic Problems with php 7.3
Great!

When you want to create a new item, i receive this error:

Warning: sizeof(): Parameter must be an array or an object that implements Countable in /www/htdocs/w0154391/projekt-rechnung/administrator/components/com_k2/views/item/view.html.php on line 442

Hope its in your update too

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

More
5 years 3 months ago #173131 by JoomlaWorks
Replied by JoomlaWorks on topic Problems with php 7.3
Install K2 v2.10 (dev) from github.com/getk2/k2/archive/master.zip and it should resolve most of these warnings. Of course, if you see any other warning with 2.10 on, do let me know.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Franz Heine
  • Franz Heine's Avatar Topic Author
  • Offline
  • Premium Member
More
5 years 3 months ago #173134 by Franz Heine
Replied by Franz Heine on topic Problems with php 7.3
Thx Fotis,

youre doing a great job! If i see other warnings, ill let you know.

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

More
5 years 3 months ago #173135 by JoomlaWorks
Replied by JoomlaWorks on topic Problems with php 7.3
Thank you Franz :)

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Franz Heine
  • Franz Heine's Avatar Topic Author
  • Offline
  • Premium Member
More
1 year 11 months ago #180625 by Franz Heine
Replied by Franz Heine on topic Problems with php 7.3 -> now php 7.4.33
Hi Fotis,
ive changed the template and the php version is 7.4

if i use following code, i receive a boolean error for &&

<?php /** Begin Bottom **/ if ($gantry->countModules('bottom')) && JRequest::getCmd( 'option' )=='com_k2' && JRequest::getCmd( 'view' )=='itemlist' && JRequest::getCmd( 'task' )=='category') : ?>

Hope youve again a idea.
Thx

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

More
1 year 11 months ago #180656 by JoomlaWorks
Replied by JoomlaWorks on topic Problems with php 7.3 -> now php 7.4.33
Code should be:
<?php

/** Begin Bottom **/
if (
    $gantry->countModules('bottom') &&
    JRequest::getCmd('option') == 'com_k2' &&
    JRequest::getCmd('view') == 'itemlist' &&
    JRequest::getCmd('task') == 'category'
): ?>

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum