owncloud / core

:cloud: ownCloud web server core (Files, DAV, etc.)
https://owncloud.com
GNU Affero General Public License v3.0
8.33k stars 2.06k forks source link

php 5.3 compatibility issue #5222

Closed DeepDiver1975 closed 10 years ago

DeepDiver1975 commented 10 years ago
PHP Fatal error:  Can't inherit abstract function OCP\IDBConnection::beginTransaction() (previously declared abstract in Doctrine\DBAL\Driver\Connection) in /root/dev/core/lib/private/db/connection.php on line 15
PHP Stack trace:
PHP   1. {main}() /root/dev/core/index.php:0
PHP   2. OC::handleRequest() /root/dev/core/index.php:30
PHP   3. require_once() /root/dev/core/lib/base.php:637
PHP   4. OC_Setup::install() /root/dev/core/core/setup.php:55
PHP   5. OC\Setup\Sqlite->setupDatabase() /root/dev/core/lib/private/setup.php:73
PHP   6. OC_DB::createDbFromStructure() /root/dev/core/lib/private/setup/sqlite.php:24
PHP   7. OC_DB::getMDB2SchemaManager() /root/dev/core/lib/private/db.php:359
PHP   8. OC_DB::getConnection() /root/dev/core/lib/private/db.php:186
PHP   9. OC_DB::connect() /root/dev/core/lib/private/db.php:175
PHP  10. Doctrine\DBAL\DriverManager::getConnection() /root/dev/core/lib/private/db.php:151
PHP  11. is_subclass_of() /root/dev/core/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php:141
PHP  12. OC\Autoloader->load() /root/dev/core/lib/autoloader.php:0
PHP  13. require_once() /root/dev/core/lib/autoloader.php:143
Testing with sqlite ...

@bartv2 Can I ask you to have a look at this?

The issue is that OCP\IDBConnection and Doctrine\DBAL\Driver\Connection declare the same method beginTransaction.

DeepDiver1975 commented 10 years ago

applies to commit() and rollback() as well

DeepDiver1975 commented 10 years ago

can we declare Doctrine\DBAL\Driver\Connection as private member instead of inherit from it?

andreas-bulling commented 10 years ago

same problem here (PHP 5.3), breaks whole owncloud installation

DeepDiver1975 commented 10 years ago

@bartv2 THX

andreas-bulling commented 10 years ago

Has nobody ever tested owncloud with PHP 5.3 or why are we seeing so many compatibility issues on this recently?

VicDeo commented 10 years ago

@andyknownasabu

php -v PHP 5.3.17 (cli)

and can't reproduce it :elephant:

andreas-bulling commented 10 years ago

PHP 5.3.3-7+squeeze17 with Suhosin-Patch

karlitschek commented 10 years ago

@andyknownasabu Can you please test with an unpatched php? suhoshin is currently not supported because they change several php functions to make it more "secure" whatevery this means.

Rayman2200 commented 10 years ago

I'm running the same setting as andyknownasabu (basic debian squeeze installation) and disabling suhosin (setting suhosin.simulation = On) does not help.

Running against the latest git version.

The latest stable owncloud 5 working fine, also with suhosin enabled. It seams to be a regression between these versions.

If it help, I can also help debugging this problem. I'm pulling 2-3 times a day the latest version from git.

kiranos commented 10 years ago

Debian 6 (squeeze) adds suhosin as default but its a module. So go to /etc/php5/conf.d/suhosin.conf or similar and move this file to another location, restart apache and try again.

But suhosin on debian is default when installing on repo, might be good to support, or otherwise, mjight not relate to this issue? as this bug should pop up all the time if so, alot of users use debian6 with apt-get install php5 libapache-php5 and run with defalt.

Rayman2200 commented 10 years ago

Does not help. The problem does not lies in suhoshin.

It's an inheritance problem. Maybe newer php versions can detect such problems better and ignore it if no conflicts exist.

//EDIT Seams to be a bug in this specific php version. https://github.com/cboden/Ratchet/issues/40#issuecomment-6947376

Maybe someone can provide a workaround for this.

bantu commented 10 years ago

Agree with @DeepDiver1975. This should be using composition instead of inheritance. Also, I don't think that OCP\IDBConnection is of much use. E.g. prepare() returns an \Doctrine\DBAL\Driver\Statement so you are basically forced to use Doctrine anyway.

PVince81 commented 10 years ago

Which PHP 5.3 version is it ? We have a box here with: PHP 5.3.10-1ubuntu3.2 with Suhosin-Patch (cli) (built: Jun 13 2012 17:19:58) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

and ownCloud 6 (master) seems to work fine with the SQLite backend. I've used a fresh clone of the repo.

DeepDiver1975 commented 10 years ago

OCP\IDBConnection is of much use. E.g. prepare() returns an \Doctrine\DBAL\Driver\Statement so you are basically forced to use Doctrine anyway.

@bantu nice catch - this needs to be fixed. PR? :wink:

DeepDiver1975 commented 10 years ago

PHP 5.3.3-7+squeeze17 with Suhosin-Patch

@PVince81

andreas-bulling commented 10 years ago

@karlitschek Disabling suhosin doesn't help I'm afraid.

@Rayman2200 The bug there seems to have been fixed. This means it now has to be included in owncloud I guess?

@all Who is looking at this bug at the moment?

@PVince81 The box I've been trying to use owncloud on here runs PHP 5.3.3-7+squeeze17 with Suhosin-Patch (cli) (built: Aug 23 2013 15:06:16) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH

andreas-bulling commented 10 years ago

I guess @bartv2 is the best person to have a look at this given that he made the relevant changes in private/db/connection.php 2 weeks ago?

DeepDiver1975 commented 10 years ago

This is the referenced pull request in react: https://github.com/reactphp/react/pull/52

Looks like this is a php bug in 5.3.3 <5.3.8

I will setup jenkins to handle 5.3.3 specific

andreas-bulling commented 10 years ago

@DeepDiver1975 This means PHP v5.3.3 will be tested for explicitly? Nice, thanks!

DeepDiver1975 commented 10 years ago

here is the Jenkins job for oc6 on php 5.3.3 https://ci.owncloud.org/job/server-master-linux-php533

@karlitschek @bartv2 @bantu

DeepDiver1975 commented 10 years ago

@andyknownasabu

andreas-bulling commented 10 years ago

Hmm, sorry, maybe I'm missing the point but how does Jenkins help here? The build fails but not because of the above error if I understand correctly. Can't anybody simply fix the bug directly? My Owncloud instance is disfunctional since more than one week now... Thanks

bantu commented 10 years ago

@andyknownasabu

Hmm, sorry, maybe I'm missing the point but how does Jenkins help here?

It helps us make sure that we do not break such things in the future.

The build fails but not because of the above error if I understand correctly.

It does fail because of this issue. See https://ci.owncloud.org/job/server-master-linux-php533/17/database=sqlite,label=master/console

My Owncloud instance is disfunctional since more than one week now...

Sorry, but that is just something you have to expect when using alpha software in production.

andreas-bulling commented 10 years ago

@bantu

Sure, but this bug was reported nearly two weeks ago and seems to be rather major given that it breaks owncloud for all Debian squeeze users... I'm not an expert - is it that difficult to fix, anything I can help with?

bantu commented 10 years ago

@andyknownasabu You could just install PHP 5.4 or 5.5 packages from dotdeb as a quick-fix.

DeepDiver1975 commented 10 years ago

is it that difficult to fix

actually not - it's just a matter of priority.

kiranos commented 10 years ago

Yeah this only effects v6 right? not 5.*

It should imo opinion be fixed when v6 is released as final but no real stress until then if its just v6 branch which is affected.

The thing to think about though, is that it limit the available testers somewhat as alot are stuck on this issue (debian 7, wheezy have 5.4 so instead of recommending dotdeb a dist upgrade would be better)

karlitschek commented 10 years ago

I think we have to fix this before the release. At the moment 5.3 is still supported

andreas-bulling commented 10 years ago

I can't upgrade to wheezy on my vserver I'm afraid :/

DeepDiver1975 commented 10 years ago

@andyknownasabu can I ask you to test the latest git master? THX

Rayman2200 commented 10 years ago

works for me thx for fixing it

andreas-bulling commented 10 years ago

Works, thanks a lot!