ElkArte Community

Elk Development => Bug Reports => Topic started by: radu81 on May 08, 2018, 06:27:02 pm

Title: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: radu81 on May 08, 2018, 06:27:02 pm
There are some active topics with reported errors in elkarte log, I'll try to post only the ones there aren't reported, sorry if I'll report something that was already reported.

from members:
Code: [Select]
    Type of error: General
    Warning: filesize(): stat failed for /public/cache/data__a02fe4740023f74aa19cdfc21c227202-ELK-permissions-0,7.php
   /index.php?board=3.0
    File: /public/sources/subs/CacheMethod/Filebased.php
    Line: 105

Code: [Select]
    Type of error: Undefined
    Exception: Call to undefined function hasTopicNotification()
    index.php?action=notify;topic=6418.0
    File: /public/sources/controllers/Notify.controller.php
    Line: 68

from a guest:
Code: [Select]
     Guest
    Type of error: General
    Warning: file_get_contents(/public/cache/data__a02fe4740023f74aa19cdfc21c227202-ELK-permissions--1.php): failed to open stream: No such file or directory
/index.php?action=dlattach;topic=4604.0;attach=37617;image
    File: /public/sources/subs/CacheMethod/Filebased.php
    Line: 107

from a guest:
Code: [Select]
    no_session_data
    Type of error: Critical
    The database value you're trying to insert does not exist: group_list
    Function: boardsAllowedTo
  /index.php?action=dlattach;attach=1334;type=avatar
    File: /public/sources/Security.php
    Line: 1231

from a guest:
Code: [Select]
    Type of error: Undefined
    Notice: Undefined index: actual_theme_dir
   index.php?action=register;sa=usernamecheck;xml;username=MauroK
    File: /public/sources/Load.php
    Line: 2454

from my account:
Code: [Select]
    Type of error: General
    Notice: A non well formed numeric value encountered
   index.php?action=profile;area=statistics;u=1
    File: /default/ProfileInfo.template.php
    Line: 445

from a member:
Code: [Select]
    Type of error: General
    Warning: array_merge(): Argument #2 is not an array
   /index.php?action=dlattach;topic=11490.0;attach=43454;image
    File: /public/sources/subs/Cache.class.php
    Line: 119

from member:
Code: [Select]
    Type of error: General
    Notice: Trying to get property 'expiration' of non-object
    /index.php?action=dlattach;topic=11490.0;attach=43458;image
    File: /public/sources/subs/CacheMethod/Filebased.php
    Line: 109
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: Spuds on May 08, 2018, 07:08:48 pm
snicker .... radu81 uses filebased caching ... snicker :P

Thanks for the reports, looks like @emanuele has been busy  O:-)
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: radu81 on May 08, 2018, 07:55:34 pm
I've done some tests on a test vps and I was able to install and use memcached. Should I use it instead of filebased cache?
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: ahrasis on May 08, 2018, 08:20:24 pm
Well php7.2 already have opcache which you can use but installing and using memcached won't hurt, I think.
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: Spuds on May 08, 2018, 08:49:49 pm
The OpCache is really for storing "precompiled " versions of the php scripts.  Precompiling removies the need for PHP to load and parse scripts on each request.

memcached saves user "data"  ... results of user and common db queries.   This reducers the load on the database, maybe some other benefits buts that is basically it ... Most of that data is cached for say 30 - 120 seconds, some shorter some longer, but that is the scope of the benefit.  So useful if you have a somewhat active site, otherwise probably neutral or a minor determent.

memcached is a good choice as is apcu for filling the user data purpose.   Filebased can be a help, better if you are using ssd's.  We could improve the filebased somewhat but I've never felt it was the best solution for standard shared or basic vps setups (thats an IMO) so I've stuck with memcached or apcu.
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: emanuele on May 09, 2018, 07:23:34 am
The last was already reported (and fixed somewhere by @Spuds I think), the others are now tracked.
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: Spuds on May 09, 2018, 10:12:31 am
I have a fix for the last one in my repo ... now I've installed 7.2 on my local as well  :'(
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: radu81 on May 10, 2018, 06:48:50 pm
Another one: if I select all topics from Recycle board and then I delete them I get "  Call to undefined function updateMemberData()" error. The topics are deleted from Recycle board.

Code: [Select]
    Type of error: Undefined
    Exception: Call to undefined function updateMemberData()
    /index.php?action=quickmod;board=15.0
    File: /sources/subs/Likes.subs.php
    Line: 1156
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: tino on May 11, 2018, 04:16:24 am
Adding
Code: [Select]
require_once(SUBSDIR . '/Members.subs.php');

Just before the foreach should solve that issue.
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: emanuele on May 16, 2018, 01:05:08 am
@radu could you please open a new topic when you report a new bug? Otherwise it may be lost. :)

I thought this one was in extermineted...never mind.
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: ahrasis on May 19, 2018, 09:20:59 am
@radu81 have you tried this:
Quote from: tino – Adding
Code: [Select]
require_once(SUBSDIR . '/Members.subs.php');

Just before the foreach should solve that issue.

If you did, do report its result. Thank you.
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: radu81 on May 19, 2018, 05:21:18 pm
there is more than one foreach in Likes.subs.php, where exactly should I add that?
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: Spuds on May 19, 2018, 05:41:16 pm
https://github.com/elkarte/Elkarte/pull/3188/commits/7299161dbbc9a4d9674566b83ff4a313645bbd11
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: Feline on June 08, 2018, 06:46:50 pm
Why not use Database caching ?
Wie have implemented that and it's much faster the Filecache (5x)
Speed in the oder:
APCU
MemCached
Database caching
File based caching

If you have PHP 7.2  Opcode caching and your Hoster allowed that, you can use this also as custom cache .. very fast !!

Fel
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: emanuele on June 09, 2018, 05:08:27 pm
TBH, in most of the cases, anything is faster than file-based caching.
Even non-cached code (actually verified in live servers).
Anyway I don't plan to spend much time on the caching code, I'd prefer at some point to swap it for some maintained library.

Anyway:
https://addons.elkarte.net/enhancement/MySQL-cache.html
https://addons.elkarte.net/enhancement/PostgreSQL-cache.html
thanks to @tino :D
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: radu81 on August 16, 2018, 07:32:08 pm
Another list of errors using Elkarte 1.1.5 and PHP 7.2.8

I don't have a privacy policy yet, and I did not asked members to accept the policy. The GDPR part is still "inactive" on my forum
Code: [Select]
    Guest
    Type of error: Critical
    Wrong value type sent to the database. Integer expected. (id_member)
    Function: accept
    index.php?action=register;sa=register2
    File: sources/subs/Agreement.class.php
    Line: 217

Code: [Select]
    Guest
    Type of error: Undefined
    Notice: Undefined index: total_time_logged_in
    index.php?action=dlattach;topic=11713.0;attach=53318;image
    File: /public/themes/default/Theme.php
    Line: 665

Code: [Select]
    Guest
    Type of error: Undefined
    Notice: Undefined index: time_format
    /index.php?action=dlattach;topic=11488.0;attach=43613;image
    File: /sources/Subs.php
    Line: 478

Code: [Select]
    Guest
    Type of error: Undefined
    Notice: Undefined index: language
    /index.php?action=dlattach;topic=11791.0;attach=53646;image
    File: sources/subs/Exception/ElkException.class.php
    Line: 168

Code: [Select]
    Guest
    Type of error: Undefined
    Notice: Undefined index: mentions
    /index.php?action=dlattach;topic=11488.0;attach=43613;image
    File: /sources/subs/UserNotification.class.php
    Line: 58
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: emanuele on August 17, 2018, 04:34:42 pm
What type of registration do you have?
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: radu81 on August 17, 2018, 05:37:07 pm
Activation by email
(https://i.imgur.com/H4cVQMq.png)

*** edit ***
I see different undefined index errors, I am wondering if it's the best way to paste them here or should I open an issue for every  undefined index error on github?
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: emanuele on August 18, 2018, 02:17:08 am
Those reported here are of 2 types:
1) something at registration due to accept the agreement,
2) something in view attachments by guests
In terms of errors repprted is okay, now it's just to understand the conditions to trigger them.
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: radu81 on August 18, 2018, 04:32:03 am
In my forum guests can see the attachments, the only strange case is that I have some attachments that are reposted in other topics using the attach code. I will check if those errors are related to those attachments. 
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: emanuele on August 18, 2018, 07:59:08 am
hmm... could be an attachment from a private board posted in a public one?
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: ahrasis on March 27, 2019, 10:13:33 am
I don't think this one is tracked yet for 1.1.6.
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: emanuele on March 27, 2019, 02:31:55 pm
The agreement part was fixed.
The attachments one... I still don't know what the problem could be.
Title: Re: Some errors with PHP 7.2 and Elkarte 1.1.3
Post by: Spuds on April 01, 2019, 04:09:54 pm
I'm not sure how do describe the error, could you log your understanding of the problem on github  O:-)