Keyword

Problems with php 7.3

  • Franz Heine
  • Franz Heine's Avatar Topic Author
  • Offline
  • Senior Member
More
2 months 1 week ago #173109 by Franz Heine
Franz Heine created the topic: Problems with php 7.3
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.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 months 1 week ago #173113 by Fotis
Fotis replied the 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)

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

  • Franz Heine
  • Franz Heine's Avatar Topic Author
  • Offline
  • Senior Member
More
2 months 1 week ago - 2 months 1 week ago #173114 by Franz Heine
Franz Heine replied the 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</A>", $comments[$i]->commentText);

Hope youve a solution for thi too.

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

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

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 months 1 week ago #173117 by Fotis
Fotis replied the 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).

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

  • Franz Heine
  • Franz Heine's Avatar Topic Author
  • Offline
  • Senior Member
More
2 months 1 week ago #173129 by Franz Heine
Franz Heine replied the 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.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 months 1 week ago #173131 by Fotis
Fotis replied the 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.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

  • Franz Heine
  • Franz Heine's Avatar Topic Author
  • Offline
  • Senior Member
More
2 months 1 week ago #173134 by Franz Heine
Franz Heine replied the 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.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 months 1 week ago #173135 by Fotis
Fotis replied the topic: Problems with php 7.3
Thank you Franz :)

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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


Powered by Kunena Forum