Error after installing

Started by addlife, March 24, 2019, 03:19:33 pm

Previous topic - Next topic

addlife

Hi I installed the mod from this site.

When clicking on the arcade admin settings to edit games, manage installations, and manage uploads it gives me this error

"Too few arguments to function mb_substr(), 2 passed in /home/xyz1/public_html/Sources/Subs-ArcadeAdmin.php on line 2244 and exactly 3 expected"

my site is 001002.xyz
and I attached the file mentioned

Any ideas how I can fix it?
Thanks.

addlife

Quote from: addlife on March 24, 2019, 03:19:33 pmHi I installed the mod from this site.

When clicking on the arcade admin settings to edit games, manage installations, and manage uploads it gives me this error

"Too few arguments to function mb_substr(), 2 passed in /home/xyz1/public_html/Sources/Subs-ArcadeAdmin.php on line 2244 and exactly 3 expected"

my site is 001002.xyz
and I attached the file mentioned

Any ideas how I can fix it?
Thanks.
I'm reinstalling SMF on the site. So as of now it's not up. I plan on having it the same way. I'll see if the error still comes up

Chen Zhen


If I remember correctly, substr was swapped out with mb_substr a while back but the length parameter was not added.
Odd thing is that I do not get this error.

The PHP manual shows that length and char encoding have defaults if not included.
ref. https://www.php.net/manual/en/function.mb-substr.php

I attached your file with that function edited to include the length parameter.

What PHP version are you using?

addlife

Quote from: Chen Zhen on March 28, 2019, 12:32:16 amIf I remember correctly, substr was swapped out with mb_substr a while back but the length parameter was not added.
Odd thing is that I do not get this error.

The PHP manual shows that length and char encoding have defaults if not included.
ref. https://www.php.net/manual/en/function.mb-substr.php

I attached your file with that function edited to include the length parameter.

What PHP version are you using?
Thanks for responding.

Sites on php version 7.1

I'm non techie so I'm not very familiar with the jargon.

Now the error is the same but says on line 2161

Chen Zhen


I had forgotten that long ago I created a custom mb_substr function where PHP found it did not exist.
That custom function requires the length parameter which I neglected to include in some circumstances.

The problem for you is that the arcade has evolved and now relies on various multibyte functions.
This should not be a problem though as most host/server control panels allow enabling that extension.

Are you using Cpanel?

If so, try this...

How to Enable mbstring in cPanel

1) Login to cPanel.

2) Go to the section 'Software'.

3) Click the icon 'Select PHP Version'

4) Select the php extension 'mbstring'.

5) Click the button 'Save'.



If you do not see the option and have support for your website, I suggest writing them a ticket & ask for the mbstring extension to be enabled.

Either way, let me know if the problem is resolved or if you need further assistance.

addlife


Thanks that fixed it.

Although now when I upload a game pack and install it through the admin section the games don't show up. I downloaded the smf gamepacks from invision. I tried 2 different gamepacks and the same thing happes. After installing it just disappears from all lists in the admin section and doesn't either show up on the arcade page either.

Although in cpanel I can see it in the games folder.

I'm getting two errors in error log

Code Select
http://001002.xyz/index.php?action=admin;area=managegames;sa=main;dda83f97bf6=76902c6ab5738584641c10b8fab50d79

8: Undefined variable: allDirs

File: /home/xyz1/public_html/Sources/Subs-ArcadeAdmin.php
Line: 2656

and

Code Select
http://001002.xyz/index.php?action=admin;area=managegames;sa=main;dda83f97bf6=76902c6ab5738584641c10b8fab50d79

2: in_array() expects parameter 2 to be array, null given

File: /home/xyz1/public_html/Sources/Subs-ArcadeAdmin.php
Line: 2656

Chen Zhen

April 12, 2019, 10:27:20 pm #6 Last Edit: April 14, 2019, 12:57:54 am by Chen Zhen Reason: removed file
Which gamepacks?
I will need to see an example for testing.

The undefined errors were due to me neglecting to define an array prior to using it.
This will be fixed in the next version release (already done to the beta).

I attached the admin file.
It is actually for the upcoming version but it should work for the version you are using.

Delete the concerned gamepacks from your Games directory.
Else try these 2 arcade maintenance options:
Quote from: undefinedPurge /home/napalmz0/public_html/Games Directory Of Compressed Archives
Purge /home/napalmz0/public_html/Games Directory Of Unused Game Folders


Try it again and let me know if you still have the same problem.

addlife

I replaced my subs-arcadeadmin file with the one you posted.

I tested it out with this classics gamepack
http://invisiongames.org/forum/index.php?download=10557

I still have the same problem. It doesn't show up after installing. Could it be that I'm missing something basic like enabling a permission or something?


BTW I'm ecited to hear that you're working on an update :)

Chen Zhen

Please download & use the attached file instead since there was a problem with the last file.



The problem is not with the arcade but with the gamepack format.
The author of the gamepack compressed a folder filled with other compressed archives.
This gamepack is likely made for IBP arcade installation and not really geared for SMF Arcade.

Since those gamepacks include some games not available in gamepacks here in the download section,
I will set them up properly and make them available.

Other gamepacks are available for the time being:
https://web-develop.ca/index.php?action=downloads;area=stable_smf_arcade_gamepacks

addlife

I don't see any gamepacks available for download on that link. It takes me to the regular download page with all your other downloads.

addlife

Oh actually I see you have a ton of games on your arcade with an option to download them. But I need 5 posts. Don't mind me spamming this thread  :P

addlife

Hopefully the last post padding post. Thanks

addlife

So I'm back again :)

I downloaded 3 single html5 games from your arcade.

Digger, p2-ball, and onslaught arena. This time it gives me this error when trying to install them

Too few arguments to function installGames(), 1 passed in /home/xyz1/public_html/Sources/ManageGames.php on line 432 and at least 2 expected

I'm on mobile so I'll try to upload the file tomorrow if you need it.

Thanks for taking your time to help :)

Chen Zhen


The function requires 3 arguments but it is being called using two arguments.
This shouldn't matter because the function's 3rd argument has a default of false.

Anyhow, you can do this edit to that file..
find:
Code Select
$_SESSION['qaction_data'] = installGames($install, $setCategory);

replace with:
Code Select
$_SESSION['qaction_data'] = installGames($install, $setCategory, false);

I tested installing those games on a local site and they work fine for me.
 

addlife

Thanks so much. That fixed it, now the games are working.



BTW the arcade page when logged in looks very neat and orderly. I'm assuming it's the updated file you gave me.