This Help forum is for issues relates to the latest release (1.7.2). For issues related to beta or github version please use their own Help forum.
Before asking for help please read "How to request help" by clicking on that tab above here."
  • Page:
  • 1

TOPIC:

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #1

  • MarekZ
  • MarekZ's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 10
Hi,

I finally moved from PHPGedview to webtrees, and from under-the-desk server to an external server (Earthlink hosting). Everything worked fine. The transfer from PGV tool did not work well - it guessed the database names wrong - but I was able to upload the gedcom, and the website worked for a moment. After I accessed the Admin tool to check the setup, the system responds with error when I point it to the website address:
#0 unknown:unknown ErrorException("preg_split() expects parameter 2 to be string, object given")
#1 /vendor/fisharebest/localization/src/Locale.php:37 preg_split()
#2 /app/I18N.php:364 create()
#3 /includes/session.php:439 init()
#4 /index.php:31 require()

Local system is Windows7, error is the same in Firefox and Chrome. I removed and re-uploaded the webtrees again and it happened again - worked initially, and now I see only this error.

Please help

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

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #2

  • MarekZ
  • MarekZ's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 10
Additional info (I have built an additional installation)
1) The problem appears only when I am logged in (as admin) and click the 'Control Panel' option. It then persists the page does not show up, only the erroro message above
2) It is possible to view the page in another browser which does not remember that the user is logged in (my two browsers are unusable this way - only error message, but was able to view the page on a different computer)
3) The address is www.zevax.com/rodzina

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

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #3

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 14515
A few people have reported this error.

webtrees stores the current language as a string (e.g. "pt-BR") in a session variable.

Somehow, this is being set to a PHP object.

I can't find anything in webtrees code that would do this. It only uses strings.

Do you know any PHP programming? Would you be able to add some debug to find out what type of object is being passed. This might give us some clues.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

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

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #4

  • MarekZ
  • MarekZ's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 10
I will be glad to help test this issue. Please let me know, what to change to add the debug. The installation is still in the testing stage, no problem if gets clobbered, I can rebuild it from saved data.

Thanks - Marek

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

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #5

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 14515
> Please let me know, what to change to add the debug.

Are you a PHP programmer?

There is no simple answer. I need someone to investigate where the session variable is set.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

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

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #6

  • MarekZ
  • MarekZ's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 10
Greg,

I am not an PHP programmer, although i do coding in .NET. I traced the error message slightly, and I can see that it is complicated.

0 unknown:unknown ErrorException("preg_split() expects parameter 2 to be string, object given")
#1 /vendor/fisharebest/localization/src/Locale.php:37 preg_split()
#2 /app/I18N.php:364 create()
// Previously used
self::$locale = Locale::create(Session::get('locale'));
#3 /includes/session.php:439 init()
// With no parameters, init() looks to the environment to choose a language
define('WT_LOCALE', I18N::init());
#4 /admin_site_config.php:22 require()
require './includes/session.php';

I did some diagnostics:

The error appears when I open the Control Panel, and switch to a sub-menu item, and then return.
I can safely switch to any Modules item and return to Manage Family Trees - those modules do not seem to set this session variable.

When I go to Users/User Administration or Users / Add New User and return to Manage Family Trees, the error appears (always the same). 'Delete inactive users' and 'Set Default Blocks' do not cause the problem)

Website/Website Preferences also cause problem (as in all cases I can enter this sub-page, but going anywhere else triggers the error)
Website/languages triggers error, Website / Sending email triggers the error
Website/Website access rules, Website/Server information do not trigger the error

Does this help? Is could be a piece of code or include used by those some sub-menus and not by the others.

If you can think of any diagnostic code put in one of those, perhaps I could test it?

-Marek

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

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #7

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 14515
> If you can think of any diagnostic code put in one of those, perhaps I could test it?

Find out what sort of object is being set? e.g.

var_dump(Session::get('locale'));
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

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

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #8

  • MarekZ
  • MarekZ's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 10
Greg,

In admin.php the variable looks OK. This is a part of the browser page:

Control panel — Dashboard
two lines added
In admin.php - var_dump follows
string(5) "en-US"
end of added code

These pages provide access to all the configuration settings and management tools for this webtrees site.

============
In admin_site_config the result is different - here (and also at the end of page) there is an object instead of a string:

The folder can be specified in full (e.g. /home/user_name/webtrees_data/) or relative to the installation folder (e.g. ../../webtrees_data/).

added 2 lines of code
admin_site_config - before Memory Limit - var_dump(Session::get('locale')) follows
object(Fisharebest\Localization\Locale\LocaleZhHans)#74 (0) { }
end of added lines

Memory limit
By default, your server allows scripts to use 256M of memory. You can request a higher or lower limit, although the server may ignore this request. If you leave this setting empty, the default value will be used.

Does it help? I can experiment more, pls. let me know;

_Marek

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

Do you need a web hosting solution for your webtrees site?
If you prefer a host that specialises in webtrees, the following page lists some suppliers able to provide one for you: 

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #9

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 14515
1) What version of PHP?

Control panel -> Website -> Server information

2) What value do you have for "register_globals"
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

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

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #10

  • MarekZ
  • MarekZ's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 10
#0 unknown:unknown ErrorException("phpinfo() has been disabled for security reasons")
#1 /admin_site_info.php:33 phpinfo()

(Earthlink hosted website)

I will see if I can get somebody to open this function for me

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

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #11

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 14515
There is a very old PHP feature called "register_globals" - and I guess that your server has enabled it.

php.net/manual/en/ini.core.php#ini.register-globals

It is disabled by default since PHP4.2 (April 2002!) but it was still possible to enable it until PHP5.3.

It means that if you set a global variable, it automatically overwites a session variable with the same name (and vice-versa).

My guess is that your server has enabled this "feature". It was removed from PHP because it is stupid/dangerous and creates security issues. Nobody should use it.

It cannot be disabled by a script such as webtrees. It can only be disabled by updating your server configuration.

If you are contacting your host, you could also ask them to upgrade PHP5.3 to a newer (supported) version.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

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

Last edit: by fisharebest. Reason: add URL

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #12

  • MarekZ
  • MarekZ's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 10
The PHP version is shown in the admin page:

Your web server is using PHP version 5.3.28

I will ask about disabling the register_globals

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

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #13

  • MarekZ
  • MarekZ's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 10
The support person gave me the solution for .htaccess

<IfModule mod_php4.c>
php_value register_globals 0
</IfModule>
<IfModule sapi_apache2.c>
php_value register_globals 0
</IfModule>
php_flag register_globals 0

Will it work?

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

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #14

  • MarekZ
  • MarekZ's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 10
Greg,

Changing the global .htaccess to include the code above seems to have done the trick. I can now access the admin pages that were showing errors before. I will do more testing, but it looks OK.

Thanks a lot for your help!

_Marek

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

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #15

  • Jackie
  • Jackie's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 4755
Hi Marek,

As Greg mentionned, your webhost will need to upgrade his PHP version. Next releases of webtrees won't work on that old / deprecated version of PHP.

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

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #16

Thanks Marek,
it works for me too.

David
Webtrees 2.0.5
MySQL-Version: 5.5.38-log
PHP-Version: 7.1.33
Win 10

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

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #17

  • Jackie
  • Jackie's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 4755
Hi,

Here are the last news of PHP:
php.net/archive/2015.php

EDIT: the version 5.3.28 was released on 12 DEC 2013
php.net/archive/2013.php#id2013-12-12-3

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

Last edit: by Jackie.

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #18

  • bertkoor
  • bertkoor's Avatar
  • Away
  • Platinum Member
  • Platinum Member
  • Greetings from Utrecht, Holland
  • Posts: 2275

version 5.3.28 was released on 12 DEC 2013

Two years, that's actually not that bad ;-P
stamboom.BertKoor.nl runs on webtrees v1.7.13

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

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #19

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 14515

Hi Marek,

As Greg mentionned, your webhost will need to upgrade his PHP version. Next releases of webtrees won't work on that old / deprecated version of PHP.


1.7.x will continue to work with PHP5.3.

FYI - I've just added a workaround for this "register globals" problem.

But the next major release (1.8 or 2.0?) will probably require PHP 5.5.9. There are lots of nice tools and libraries that we can use, but they all require a modern version of PHP.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

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

Last edit: by fisharebest.

preg_split() expects parameter 2 to be string, obj 5 years 4 months ago #20

  • MarekZ
  • MarekZ's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 10
Greg,

I just wanted to say, that I love webtrees. After PhoGedView it works much smoother. Still working out the users (time to clean them out), and geo-coding (home is not much different). But the main part works fine.

I hope my provider (Earthlink) will upgrade by that time, or I will be faced with the "Curse of the Upgrade" - either forgo new better software or look for another hosting service, which will work for a while until the next conflict arises. I guess there is no way out. In the place I volunteer we still have a number of computers with XP. Upgrade is time consuming and costly, because the scanners (otherwise in good working order) and other equipment stop working.

All the best in the New Year

Marek

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

  • Page:
  • 1
Powered by Kunena Forum