Username
Forgot password?
Welcome to our site!
Or Join with FTTF

Registration failed. Argument 2 passed to MongoCollection::insert() must be an array, boolean given...

0

4494 views
Hello,

I'm new to MongoDB and LampCMS and I faced problem during last stage of install. Can't create new (first) user. After filling "Username", "E-mail" and "Captcha" and pressing "Register" button I reveive following error.


Alert
Caught catchable fatal error in file: /var/www/html/LampCMS/lib/Lampcms/Mongo/DB.php
on line: 226

Error message:
Argument 2 passed to MongoCollection::insert() must be an array, boolean given, called in /var/www/html/LampCMS/lib/Lampcms/Mongo/Doc.php on line 555 and defined
error code: 1 file: /var/www/html/LampCMS/!inc.php line: 177
Trace:
#0 (): LampcmsErrorHandler(4096, 'Argument 2 passed to MongoCollection::insert() must be an array, boolean given, called in /var/www/html/LampCMS/lib/Lampcms/Mongo/Doc.php on line 555 and defined', '/var/www/html/LampCMS/lib/Lampcms/Mongo/DB.php', 226, Array)
#1 /var/www/html/LampCMS/lib/Lampcms/Mongo/DB.php(226): insert(Array, true)
#2 /var/www/html/LampCMS/lib/Lampcms/Mongo/Doc.php(555): insertData('USERS', Array)
#3 /var/www/html/LampCMS/lib/Lampcms/Mongo/Doc.php(472): insert()
#4 /var/www/html/LampCMS/lib/Lampcms/Controllers/Register.php(258): save()
#5 /var/www/html/LampCMS/lib/Lampcms/Controllers/Register.php(180): createNewUser()
#6 /var/www/html/LampCMS/lib/Lampcms/WebPage.php(272): main()
#7 /var/www/html/LampCMS/www/index.php(89): __construct(Lampcms\Registry)

Apache and MongoDB logs are silent on this action.

My system is CentOS release 5.5 running inside OpenVZ container. I saw the message in MongoDB log, which says that it will cause errors while running it inside OpenVZ, but I decided to give it a chance.

What do think, what can cause this error?
 
asked February 17, 2012 at 3:59 AM

 lv

1 Answer

1
Best answer
 
Thank you. This is interesting, looks like the API for this mongoCollection may have changed since I wrote the class. I mean, there has been several updates to php's Mongo library since then.

Originally it was possible to pass 'true' to MongoCollection insert method as second parameter, meaning a 'safe' mode, meaning to write data to disk immediately.

Indeed, looking a the latest documentation on php.net site it does say that second param cannot be boolean anymore.

http://us2.php.net/manual/en/mongocollection.insert.php

I will make update now and will commit the update to github ASAP.

Thank you.
flag
answered February 19, 2012 at 5:47 PM
I just made that change and pushed update to github. You can download the latest version now and it will work. Let me know if there are any other issues you notice.
flag
Feb 19 '12 at 20:33
@Dmitri Snytkine
Thank you, now all work fine.
flag
Feb 20 '12 at 11:51

Your answer

Join with account you already have

FTTF

Preview

Alert