Trying to get property of non-object in PermissionService when trying to update roles. #383

Closed
opened 2017-05-01 12:53:03 +02:00 by ghost · 8 comments
ghost commented 2017-05-01 12:53:03 +02:00 (Migrated from github.com)

For Bug Reports

  • BookStack Version: v0.16.1
  • PHP Version: 5.6.27
  • MySQL Version: MariaDB 10.0.15
Expected Behavior

While updating a role or changing the permission of the user we are getting the following error

production.ERROR: exception 'ErrorException' with message 'Trying to get property of non-object' in /var/www/html/app/Services/PermissionService.php:405
Actual Behavior

It should update the roles or permissions properly

Please find the attached log file.
laravel.txt

### For Bug Reports * BookStack Version: v0.16.1 * PHP Version: 5.6.27 * MySQL Version: MariaDB 10.0.15 ##### Expected Behavior While updating a role or changing the permission of the user we are getting the following error ``` production.ERROR: exception 'ErrorException' with message 'Trying to get property of non-object' in /var/www/html/app/Services/PermissionService.php:405 ``` ##### Actual Behavior It should update the roles or permissions properly Please find the attached log file. [laravel.txt](https://github.com/BookStackApp/BookStack/files/967705/laravel.txt)
AbijeetP commented 2017-05-01 12:55:16 +02:00 (Migrated from github.com)
Related to https://github.com/BookStackApp/BookStack/issues/374
ssddanbrown commented 2017-05-01 19:08:57 +02:00 (Migrated from github.com)

Hi @bharadwajag, Thanks for reporting and sorry you are still having issues here.

I think this may be due to how variables types are converted between the MySQL and PHP though, unfortunately, I have not yet been able to replicate the issue.

Would you be able to confirm the operating system you are running BookStack on and, If you know, the PHP-MySQL driver in use so I can fully replicate your setup?

Hi @bharadwajag, Thanks for reporting and sorry you are still having issues here. I think this may be due to how variables types are converted between the MySQL and PHP though, unfortunately, I have not yet been able to replicate the issue. Would you be able to confirm the operating system you are running BookStack on and, If you know, the PHP-MySQL driver in use so I can fully replicate your setup?
ghost commented 2017-05-02 08:40:26 +02:00 (Migrated from github.com)

@ssddanbrown
As you requested,
OS: Debian Jessie 8.6
Please find the attached file for PHP-MySQL drivers info
php-mysql-drivers
Please let us know if you need any other info that I can.

@ssddanbrown As you requested, **OS**: **Debian Jessie 8.6** Please find the attached file for PHP-MySQL drivers info ![php-mysql-drivers](https://cloud.githubusercontent.com/assets/7804894/25606668/413dcaa0-2f30-11e7-99ee-bcd630a82f80.png) Please let us know if you need any other info that I can.
AbijeetP commented 2017-05-02 14:50:50 +02:00 (Migrated from github.com)
if ($entity->isA('page') && $entity->chapter_id !== 0 && $entity->chapter_id !== '0') {
	 // more code here...
}

For now I've added a kludge fix by adding the above code.

``` if ($entity->isA('page') && $entity->chapter_id !== 0 && $entity->chapter_id !== '0') { // more code here... } ``` For now I've added a kludge fix by adding the above code.
ssddanbrown commented 2017-05-07 20:40:22 +02:00 (Migrated from github.com)

@bharadwajag Sorry for my slow response on this one, I've had limited time recently. I've updated the release branch with the fix from @AbijeetP in.

This was only apparent when not using the mysqlnd driver. The mysqlnd driver provides data in the correct type whereas other drivers do not.

@bharadwajag Sorry for my slow response on this one, I've had limited time recently. I've updated the release branch with the fix from @AbijeetP in. This was only apparent when not using the `mysqlnd` driver. The `mysqlnd` driver provides data in the correct type whereas other drivers do not.
Shackelford-Arden commented 2017-05-11 00:06:41 +02:00 (Migrated from github.com)

@ssddanbrown Just a note for this item, by default in Ubuntu 17.04, apt will pull php-mysql instead of php-mysqlnd.

image

Note sure how this affects things but figured I'd make a note.

@ssddanbrown Just a note for this item, by default in Ubuntu 17.04, apt will pull php-mysql instead of php-mysqlnd. ![image](https://cloud.githubusercontent.com/assets/7362263/25923382/df31789c-35a2-11e7-95b3-f812c9003640.png) Note sure how this affects things but figured I'd make a note.
ssddanbrown commented 2017-05-11 00:46:35 +02:00 (Migrated from github.com)

@Shackelford-Arden Thanks for letting me know.

I may be wrong but from looking at this before, I think all php-mysql extensions installed on ubuntu versions that provide php7.0 and above by default (Ubuntu 16.04+) will effectively use mysqlnd by default as the old mysql driver was removed in php7.

This can be seen by running apt-show:

$  apt show php7.0-mysql
Package: php7.0-mysql
Version: 7.0.15-0ubuntu0.16.04.4
Priority: optional
Section: php
Source: php7.0
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 473 kB
Provides: php-mysqli, php-mysqlnd, php-pdo-mysql, php7.0-mysqli, php7.0-mysqlnd, php7.0-pdo-mysql

Take note of the last 'Provides' line above. It's installing mysqlnd which mysqli and pd-mysql are then using.

@Shackelford-Arden Thanks for letting me know. I may be wrong but from looking at this before, I think all php-mysql extensions installed on ubuntu versions that provide php7.0 and above by default (Ubuntu 16.04+) will effectively use mysqlnd by default as the old mysql driver was removed in php7. This can be seen by running apt-show: ```bash $ apt show php7.0-mysql Package: php7.0-mysql Version: 7.0.15-0ubuntu0.16.04.4 Priority: optional Section: php Source: php7.0 Origin: Ubuntu Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> Original-Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org> Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 473 kB Provides: php-mysqli, php-mysqlnd, php-pdo-mysql, php7.0-mysqli, php7.0-mysqlnd, php7.0-pdo-mysql ``` Take note of the last 'Provides' line above. It's installing mysqlnd which mysqli and pd-mysql are then using.
Shackelford-Arden commented 2017-05-11 16:35:56 +02:00 (Migrated from github.com)

Aha! That's good to know!

Learn something new every day 👍 I wasn't aware of the "apt show" command.

Thanks @ssddanbrown ! If anything, it might be something to note in your installation instructions. I'd help, I'm not just sure how...

Aha! That's good to know! Learn something new every day 👍 I wasn't aware of the "apt show" command. Thanks @ssddanbrown ! If anything, it might be something to note in your installation instructions. I'd help, I'm not just sure how...
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bookstack/bookstack#383
No description provided.