Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing by link file/dir shared to group #17867

Closed
nazar-pc opened this issue Jul 25, 2015 · 19 comments
Closed

Sharing by link file/dir shared to group #17867

nazar-pc opened this issue Jul 25, 2015 · 19 comments

Comments

@nazar-pc
Copy link
Contributor

ownCloud 8.1 stable release.
Configured to require expiration to be set, defaults to 7 days.

Issue results in the same error as #17069 (where was initially reported in comments starting from #17069 (comment)), but seems to have different origin.

How it happens:

  • share directory to some group of users
  • login as one of users from that group
  • click sharing on directory shared with you, try to share via link

As result infinite spinner, 500 error and log:

Call to a member function format() on string at /usr/share/nginx/html/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Types/DateTimeType.php#53

However, re-sharing to other users and groups works fine.

It doesn't happen with fresh installation, still don't know how to make it reproducible yet.

For whatever reason $value has string 2015-07-28 00:00:00 in it instead of \DateTime instance.
Here is backtrace from error place:

Array
(
    [0] => Array
        (
            [file] => /usr/share/nginx/html/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Statement.php
            [line] => 114
            [function] => convertToDatabaseValue
            [class] => Doctrine\DBAL\Types\DateTimeType
            [type] => ->
        )

    [1] => Array
        (
            [function] => bindValue
            [class] => Doctrine\DBAL\Statement
            [type] => ->
        )

    [2] => Array
        (
            [file] => /usr/share/nginx/html/owncloud/lib/private/db/statementwrapper.php
            [line] => 57
            [function] => call_user_func_array
        )

    [3] => Array
        (
            [file] => /usr/share/nginx/html/owncloud/lib/private/share/share.php
            [line] => 2228
            [function] => __call
            [class] => OC_DB_StatementWrapper
            [type] => ->
        )

    [4] => Array
        (
            [file] => /usr/share/nginx/html/owncloud/lib/private/share/share.php
            [line] => 2228
            [function] => bindValue
            [class] => OC_DB_StatementWrapper
            [type] => ->
        )

    [5] => Array
        (
            [file] => /usr/share/nginx/html/owncloud/lib/private/share/share.php
            [line] => 2086
            [function] => insertShare
            [class] => OC\Share\Share
            [type] => ::
        )

    [6] => Array
        (
            [file] => /usr/share/nginx/html/owncloud/lib/private/share/share.php
            [line] => 754
            [function] => put
            [class] => OC\Share\Share
            [type] => ::
        )

    [7] => Array
        (
            [file] => /usr/share/nginx/html/owncloud/lib/public/share.php
            [line] => 264
            [function] => shareItem
            [class] => OC\Share\Share
            [type] => ::
        )

    [8] => Array
        (
            [file] => /usr/share/nginx/html/owncloud/core/ajax/share.php
            [line] => 63
            [function] => shareItem
            [class] => OCP\Share
            [type] => ::
        )

    [9] => Array
        (
            [file] => /usr/share/nginx/html/owncloud/lib/private/route/route.php(154) : runtime-created function
            [line] => 1
            [args] => Array
                (
                    [0] => /usr/share/nginx/html/owncloud/core/ajax/share.php
                )

            [function] => require_once
        )

    [10] => Array
        (
            [function] => __lambda_func
        )

    [11] => Array
        (
            [file] => /usr/share/nginx/html/owncloud/lib/private/route/router.php
            [line] => 274
            [function] => call_user_func
        )

    [12] => Array
        (
            [file] => /usr/share/nginx/html/owncloud/lib/base.php
            [line] => 867
            [function] => match
            [class] => OC\Route\Router
            [type] => ->
        )

    [13] => Array
        (
            [file] => /usr/share/nginx/html/owncloud/index.php
            [line] => 40
            [function] => handleRequest
            [class] => OC
            [type] => ::
        )

)

2015-07-28 is anyway a weird date, which is less than 4 days from todays 2015-07-24 and I have required expiration time set to 7 days be default.

I found that expiration date format becomes incorrect here: https://github.com/owncloud/core/blob/master/lib/private/share/share.php#L2162

While $expirationDate is a correct \DateTime instance, $checkReshare['expiration'] is string with weird 2015-07-28 00:00:00 value.

@rullzer
Copy link
Contributor

rullzer commented Jul 25, 2015

@nazar-pc could you also fill in the missing stuff from the issue template https://raw.githubusercontent.com/owncloud/core/master/issue_template.md

@nazar-pc
Copy link
Contributor Author

Server configuration

Operating system: debian:jessie docker image (common base for all containers)

Web server: Nginx (separate docker container)

Database: MariaDB (separate docker container)

PHP version: 5.6 (separate docker container)

ownCloud version: 8.1.0 (stable)

Updated from an older ownCloud or fresh install: fresh installation using https://github.com/nazar-pc/docker-webserver-apps/tree/master/owncloud

List of activated apps:

Enabled:
 - activity: 2.0.1
 - calendarplus: 1.0.1
 - contacts: 0.4.0.0
 - delete_confirmation: 1.0.1
 - documents: 0.10.0
 - files: 1.1.9
 - files_external: 0.2.3
 - files_locking: 
 - files_mv: 0.8.1a
 - files_pdfviewer: 0.7
 - files_sharing: 0.6.2
 - files_texteditor: 0.4
 - files_trashbin: 0.6.3
 - files_versions: 1.0.6
 - files_videoviewer: 0.1.3
 - firstrunwizard: 1.1
 - galleryplus: 13.0.0
 - provisioning_api: 0.2
 - tasksplus: 1.0.0
 - templateeditor: 0.1
 - updater: 0.6
Disabled:
 - calendar
 - direct_menu
 - encryption
 - external
 - gallery
 - tasks
 - user_external
 - user_ldap
 - user_webdavauth

The content of config/config.php:

$CONFIG = array (
  'instanceid' => '***',
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' => 
  array (
    0 => '***',
  ),
  'datadirectory' => '/data/nginx/www/owncloud/data',
  'overwrite.cli.url' => 'https://***',
  'dbtype' => 'mysql',
  'version' => '8.1.0.8',
  'dbname' => '****',
  'dbhost' => 'mysql',
  'dbtableprefix' => '***',
  'dbuser' => '***',
  'dbpassword' => '***',
  'logtimezone' => 'UTC',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_from_address' => 'owncloud',
  'mail_domain' => '***',
  'mail_smtpauthtype' => 'PLAIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '***',
  'mail_smtpport' => '587',
  'mail_smtpname' => '***',
  'mail_smtppassword' => '***',
  'forcessl' => true,
  'theme' => '',
  'maintenance' => false,
  'loglevel' => 1,
  'log_rotate_size' => 2097152,
);

Are you using external storage, if yes which one: local

Are you using encryption: no

@PVince81
Copy link
Contributor

@MorrisJobke is your PR #17489 related to this issue ?

@nazar-pc
Copy link
Contributor Author

It seems so, but anyway getItems() method is too big and complex, just like I've mentioned in comments to #17069, and better solution is to fix the root of the problem. I didn't find a way to reproduce this issue either, but it happens all the time on one of installations of 8.1, so bug exists in latest stable release, and, likely, in master branch. This will cause even more unpredictable harm in future.

@MorrisJobke
Copy link
Contributor

@nazar-pc Can you test my PR and check if it fixes the failures. The sharing code is awaiting a overhaul nevertheless, but this should be a short-term solution that is also backportable. Thanks :)

@nazar-pc
Copy link
Contributor Author

@MorrisJobke, it works, kind of, because it produces weird pre-filled date, namely 2015-8-3 00:00:00 (7 days from now), zeroes are lacking for day and month, but it corresponds to real settings, which is good.

@MorrisJobke
Copy link
Contributor

namely 2015-8-3 00:00:00 (7 days from now), zeroes are lacking for day and month, but it corresponds to real settings, which is good.

Yes. Weird stuff, but this is how the sharing code nowadays want to have the date 🙈 🙉 🙊 cc @schiesbn

@rullzer
Copy link
Contributor

rullzer commented Jul 28, 2015

Yes. Weird stuff, but this is how the sharing code nowadays want to have the date 🙈 🙉 🙊 cc @schiesbn

It is because it is stored in the database as a DATETIME
We'll tackle that for sharing 2.0 as well. But changing it now is guaranteed to break stuff.

@nazar-pc
Copy link
Contributor Author

nazar-pc commented Oct 1, 2015

Issue is back in 8.1.3, 8.1.1 worked fine

@PVince81
Copy link
Contributor

PVince81 commented Oct 1, 2015

not sure what happened...

@PVince81 PVince81 self-assigned this Dec 3, 2015
@PVince81 PVince81 added this to the 9.0-current milestone Dec 3, 2015
@rullzer
Copy link
Contributor

rullzer commented Feb 10, 2016

With the new sharing code this should be fixed

@rullzer rullzer modified the milestones: 8.2.3-current-maintenance, 9.0-current Feb 12, 2016
@rullzer
Copy link
Contributor

rullzer commented Feb 12, 2016

@PVince81 @cmonteroluque moving to 8.2.3 since this bug lives in the old sharing code.

@ghost
Copy link

ghost commented Feb 13, 2016

#17867 (comment) @rperezb @SergioBertolinSG @davitol can you please test with 9.0?

@rullzer ok with the move otherwise

@ghost
Copy link

ghost commented Feb 23, 2016

@rperezb @davitol please test

@ghost
Copy link

ghost commented Feb 24, 2016

@rperezb @davitol ping

@davitol
Copy link
Contributor

davitol commented Feb 25, 2016

@davitol can you please test with 9.0?

Tested in 9.0 and I could not reproduce it.

@PVince81
Copy link
Contributor

@davitol what about 8.2.2 and 8.1.5 ?

It was reported to be broken again in 8.1.3 while 8.1.1 worked: #17867 (comment)

@Dianafg76
Copy link

It doesn't happen with fresh installation

I can reproduce the error with version 8.1.2 and 8.1.3 with fresh installation

With v 8.1.5 and v 8.2.2 I can not reproduce it with fresh installation

@ghost ghost closed this as completed Feb 26, 2016
@lock
Copy link

lock bot commented Aug 6, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 6, 2019
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants