The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error in DB.php line 51
#1
First, I'd like to say I appreciate the time and effort put into this project, it's a huge help for coders like me.

I'm integrating UserSpice into a pre-existing website built is pure PHP, and we're already using PDO to handle all MYSQL calls. I've installed UserSpice but all the pages are loading blank. In my apache error logs, this is the message:

PHP Catchable fatal error: Object of class stdClass could not be converted to string in users/classes/DB.php on line 51

I've been trying like crazy to figure this our, but to no avail.
  Reply
#2
Hmm. Sorry you're having problems.

What version of PHP are you using?

That error is caused by a query that is not working for some reason. If you haven't modified the userspice code, that's really rare. How did you integrate userspice into that existing project? How did you modify your existing pages to work with US?

My thought is that I would leave your existing project exactly the way it was with two exceptions:

At the top of the page add the require to users/init.php
Add that securePage line that's on every page to secure the pages.

Let me know what you come up with.
  Reply
#3
Haven't changed any of the US files, only thing I've done is copy them to a sub folder and ran the installation.

I've actually just deleted everything, re-downloaded the US files again and reinstalled. Now, after installation, I can access the login.php page and create accounts and everything.

I require_once'd the init.php file, and it's finding it fine, however I still am getting broken pages when trying to call securePage(). Here is the error log:

PHP Fatal error: Call to undefined function securePage()...

I thought I might not be loading init.php, but I placed an echo "test" and it comes up.

The PHP version I'm using us 5.5.9
  Reply
#4
Let me clarify that I've requried'd once the init.php in my pre-existing header. I'm trying to create an account and login, and then redierct to my homepage while utilizing the user's information through the $user object. I'm including the init.php, but it's acting now like it's loading an empty file...
  Reply
#5
To test, I added on the bottom of the User.php "echo 'User class is loaded';" to make sure it's actually working, and it's echoing in my header just fine, but none of the functions or objects are passing through
  Reply
#6
I'm out of the office today so I can't really get to my computer to help you better but do you have the option to switch to version 5.6 of PHP?
  Reply
#7
I will do so and see if that will work
  Reply
#8
Upgrading PHP to 5.6 seemed to have done the trick. All files are loading good! Now I have a different question. Instead of PHP errors, there's this message:

You must go into the Admin Panel and click the Manage Pages button to add this page to the database. Doing so will make this error go away.

So I have all US files is a subfolder. My existing site would be accessed buy going up a folder in the hierarchy, like with a "../" statement. Is there a function I may have missed that would add pages by going up a folder?
  Reply
#9
Awesome. It looks like some of our recent security fixes may have broken compatibility with version 5.5. I will update that in the installer.

In the root of the project is a file called Z us root. In there on line two or three there is an array of folders. You can add whatever subfolders you want in there and userspice will pick them up.
  Reply
#10
Got it worked out. I tried adding '../' to the array, then went to the admin_pages.php page and it saw all the new files I wanted, however when I loaded the web pages it still gave me the same error. I wound up moving my US root to the actual root of my web files instead of in a sub-folder. Thank you guys for helping me out!
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)