Mibew / mibew

Mibew Messenger - open-source live support application
https://mibew.org
Other
473 stars 204 forks source link

Can't install on PHP 8.1 #271

Open Akiracr opened 2 years ago

Akiracr commented 2 years ago

Environment

Deprecated: Return type of Symfony\Component\HttpFoundation\ParameterBag::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/ak/mibew/vendor/symfony/http-foundation/ParameterBag.php on line 220

Deprecated: Return type of Symfony\Component\HttpFoundation\ParameterBag::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/ak/mibew/vendor/symfony/http-foundation/ParameterBag.php on line 230

Deprecated: Return type of Symfony\Component\HttpFoundation\HeaderBag::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/ak/mibew/vendor/symfony/http-foundation/HeaderBag.php on line 288

Deprecated: Return type of Symfony\Component\HttpFoundation\HeaderBag::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/ak/mibew/vendor/symfony/http-foundation/HeaderBag.php on line 298

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/html/ak/mibew/vendor/symfony/http-foundation/Request.php on line 316

Warning: session_start(): Session cannot be started after headers have already been sent in /var/www/html/ak/mibew/libs/init.php on line 67

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/html/ak/mibew/vendor/symfony/http-foundation/Request.php on line 316

Deprecated: Return type of Symfony\Component\Routing\RouteCollection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/ak/mibew/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php on line 56

Deprecated: Return type of Symfony\Component\Routing\RouteCollection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/ak/mibew/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php on line 66

Deprecated: Symfony\Component\Config\Resource\FileResource implements the Serializable interface, which is deprecated. Implement serialize() and unserialize() instead (or in addition, if support for old PHP versions is necessary) in /var/www/html/ak/mibew/vendor/symfony/config/Symfony/Component/Config/Resource/FileResource.php on line 21

Deprecated: Symfony\Component\Routing\Route implements the Serializable interface, which is deprecated. Implement serialize() and unserialize() instead (or in addition, if support for old PHP versions is necessary) in /var/www/html/ak/mibew/vendor/symfony/routing/Symfony/Component/Routing/Route.php on line 22

Deprecated: Symfony\Component\Routing\CompiledRoute implements the Serializable interface, which is deprecated. Implement serialize() and unserialize() instead (or in addition, if support for old PHP versions is necessary) in /var/www/html/ak/mibew/vendor/symfony/routing/Symfony/Component/Routing/CompiledRoute.php on line 19

Fatal error: Database was not initialized correctly in /var/www/html/ak/mibew/libs/classes/Mibew/Database.php on line 120

Steps to reproduce the behavior

Go to http://127.0.0.1/ak/mibew/install.php in a clean build

faf commented 2 years ago
  1. You didn't specified the version of Mibew Messenger.
  2. How have you got Mibew to install? Has it been downloaded from our official site, or have you built it youself?
Akiracr commented 2 years ago

Hi @faf, sorry for the missing information.

I clone master and built it myself as result of it was mibew-3.5.7.zip, I've download a zip from the official site and compared them with my build and it is practically are equals, so i've tested that version and the result are the same deprecated messages.

Please tell me if you need more information or if there is something that i can do to help to solve the problem.

faf commented 2 years ago

@Akiracr Well, ok, I'll try to reproduce the issue. What Ubuntu distro do you use? And what PHP modules are installed (you could just post the output of php -m command).

At the moment I could only guess that the last fatal error probably means that you hadn't properly set database connection options in the configuration.

Akiracr commented 2 years ago

I'm running it on a docker php:8.1-apache container, i've reviewed an it is Debian 11 (bullseye), the result of "php -m" is

[PHP Modules]
bcmath
Core
ctype
curl
date
dom
fileinfo
filter
ftp
gd
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
soap
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

My database config settings seems to be ok, it can't connect to the database but /install redirects to /operator/login, here is the complete output when try to access to /install

Deprecated: Return type of Symfony\Component\HttpFoundation\ParameterBag::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/ak/mibew/vendor/symfony/http-foundation/ParameterBag.php on line 220

Deprecated: Return type of Symfony\Component\HttpFoundation\ParameterBag::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/ak/mibew/vendor/symfony/http-foundation/ParameterBag.php on line 230

Deprecated: Return type of Symfony\Component\HttpFoundation\HeaderBag::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/ak/mibew/vendor/symfony/http-foundation/HeaderBag.php on line 288

Deprecated: Return type of Symfony\Component\HttpFoundation\HeaderBag::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/ak/mibew/vendor/symfony/http-foundation/HeaderBag.php on line 298

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/html/ak/mibew/vendor/symfony/http-foundation/Request.php on line 316

Warning: session_start(): Session cannot be started after headers have already been sent in /var/www/html/ak/mibew/libs/init.php on line 67
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mibew.plugin' doesn't exist
faf commented 2 years ago

So, to sum it up, the problem occurs in Debian 11. Right?

Akiracr commented 2 years ago

Yes

faf commented 2 years ago

Ok. I've set up the clear system with Debian 11.

To begin with your installation is definetely is not the standard Debian 11. Since Debian 11 comes with PHP 7.4. Though, it's not a big deal to set PHP 8.1 there.

Then. Your problem consists of two parts.

  1. Deprecation warnings.
  2. Fatal error.

I was able to reproduce the first part. I was able to (partly) reproduce the second part. I was unable to reproduce the whole issue in the way you've described.

Deprecation warnings comes from the Symfony framework. I have some ideas on how to get rid of them, but at the moment I'm unable to say when that will happen. Right now the most simple way is to hide that warnings by either disabling the display_errors option in mod_php config, or at least set the error_reporting to recommended production value of E_ALL & ~E_DEPRECATED & ~E_STRICT.

As of fatal error... Frankly, no idea. I'm unable to reproduce it.

  1. Double check your database connection settings in config.yml. Does your database exists? Does your database user has permissions to access and manage the database?
  2. Do you have mod_rewrite enabled and AllowOverride All option set in the configuration of Apache2?
Akiracr commented 2 years ago

Hi @faf, thanks for your time and comments, i has been testing and found that mibew is not compatible with PHP 8.0 and 8.1, on PHP 7.4 works without problems and warnings.

It cound be because some symfony dependencies are so old and are under unmaintain status.

I'll try to work on it.

faf commented 2 years ago

i has been testing and found that mibew is not compatible with PHP 8.0 and 8.1, on PHP 7.4 works without problems and warnings.

That's not true. Mibew Messenger is compatible with PHP 8.1 since v3.4.3. For example, our demo installation works on PHP 8.1.

Warnings on deprecated features (that comes from some Symfony components as well as from some parts of Mibew itself) doesn't mean that the code is not functional. It will become not functional with future versions of PHP, but at the moment the code works.

Akiracr commented 2 years ago

Umm, could you test the installation on PHP 8.1 recently?

My environments of php 8.1, 8.0 and 7.4 are indical about OS, Apache, and php extensions, but in PHP 8.0 and 8.1 gets fatal error. Maybe there are some problem only with the instalation process.

faf commented 2 years ago

Yes, it was tested on clean Debian 11 system (with attached deb.sury.org repo to get PHP 8.1). Both install and main functionality works fine except for deprecation warnings when standard PHP settings altered to produce most verbose output.