B
B
boris tyrepharm2019-05-11 12:32:18
1C-Bitrix
boris tyrepharm, 2019-05-11 12:32:18

Bitrix and Google Calendar integration?

Good afternoon!
I'm trying to integrate Google Calendar via PHP API: https://developers.google.com/calendar/quickstart/php
with Bitrix project (CentOS 7 installed, Bitrix Web Environment, composer configured) Trying
to initialize PHP example https:// github.com/gsuitedevs/php-samples/blob/mas...
via console:
php quickstart.php
following error occurs:

PHP Fatal error:  Uncaught UnexpectedValueException: Overloading of string functions using mbstring.func_overload is not supported by phpseclib. in /home/bitrix/www/local/vendor/phpseclib/phpseclib/phpseclib/bootstrap.php:11
Stack trace:
#0 /home/bitrix/www/local/vendor/composer/autoload_real.php(66): require()
#1 /home/bitrix/www/local/vendor/composer/autoload_real.php(56): composerRequire42b6e0827500b0c2ab7479c76cf79675('decc78cc4436b12...', '/home/bitrix/ww...')
#2 /home/bitrix/www/local/vendor/autoload.php(7): ComposerAutoloaderInit42b6e0827500b0c2ab7479c76cf79675::getLoader()
#3 /home/bitrix/www/local/quickstart.php(2): require('/home/bitrix/ww...')
#4 {main}
  thrown in /home/bitrix/www/local/vendor/phpseclib/phpseclib/phpseclib/bootstrap.php on line 11

As you know, Bitrix uses the value of the variable mbstring.func_overload = 2, which, as you can see, is not allowed in this script.
Therefore, in the /etc/httpd/bx/conf/default.conf configuration file, I added the following code to override the value of the mbstring.func_overload variable in the local folder and restarted the web server:
<Directory /home/bitrix/www/local>
    php_admin_value mbstring.func_overload 0
    php_value default_charset utf8
</Directory>

But the same error still occurs. Moreover, if you execute the phpinfo() function in the local folder
, then the report will show that the mbstring.func_overload variable has:
Local Value: 0
Master Value: 2

How to make friends with Google Calendar and Bitrix?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
serginhold, 2019-05-12
@serginhold

Perhaps the exception is not simple there, but if there is confidence that the package will work fine without it, then this exception should be removed. As an option to fork both repositories, in Google change composer.json to your phpseclib fork, in which to remove the exception

R
Roman Gritsuk, 2019-05-13
@winer

In your script, this phpseclib library gives an error.
If you do not need to access the Google Calendar api very often, you can use this crutch:
- Create a section in the public part of the site. for example ./func_overload_0
- In the server settings, set exactly for it mbstring.func_overload 0
- place a call to methods for working with the Google Calendar API in index.php of this section.
- In your methods, access this code via curl or Main\Web\HttpClient()
mbstring.func_overload 0 for some directory will work if this directory is the entry point. Therefore, using such a crutch, you can make libraries like this work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question