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

Closed
opened 2026-02-04 18:30:26 +03:00 by OVERLORD · 8 comments
Owner

Originally created by @ghost on GitHub (May 1, 2017).

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

Originally created by @ghost on GitHub (May 1, 2017). ### 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)
Author
Owner

@AbijeetP commented on GitHub (May 1, 2017):

Related to https://github.com/BookStackApp/BookStack/issues/374

@AbijeetP commented on GitHub (May 1, 2017): Related to https://github.com/BookStackApp/BookStack/issues/374
Author
Owner

@ssddanbrown commented on GitHub (May 1, 2017):

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?

@ssddanbrown commented on GitHub (May 1, 2017): 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?
Author
Owner

@ghost commented on GitHub (May 2, 2017):

@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.

@ghost commented on GitHub (May 2, 2017): @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.
Author
Owner

@AbijeetP commented on GitHub (May 2, 2017):

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.

@AbijeetP commented on GitHub (May 2, 2017): ``` 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.
Author
Owner

@ssddanbrown commented on GitHub (May 7, 2017):

@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.

@ssddanbrown commented on GitHub (May 7, 2017): @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.
Author
Owner

@Shackelford-Arden commented on GitHub (May 11, 2017):

@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.

@Shackelford-Arden commented on GitHub (May 11, 2017): @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.
Author
Owner

@ssddanbrown commented on GitHub (May 11, 2017):

@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.

@ssddanbrown commented on GitHub (May 11, 2017): @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.
Author
Owner

@Shackelford-Arden commented on GitHub (May 11, 2017):

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...

@Shackelford-Arden commented on GitHub (May 11, 2017): 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.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#329