convertNumericType error in Zend Framework 2 with Doctrine MongoDB ODM

One stupid error kicked my ass for the last few days (Sorry for writing in this way). Recently I am working on a project with Zend Framework 2 and Doctrine MongoDB ODM. Platform Setting up killed five days only for the MongoDB driver’s bug. My platform based on Ubuntu 12.04, PHP 5.3 with Zend Framework 2 and MongoDB. I got this error when I am trying to insert something into Database. I am getting a weird error in Doctrine library. At first, my through was that it’s Zend framework 2’s error. Because it had been released a few days ago. Still lot of bugs require to be fixed. But it was coming from MongoDB PHP library in the Zend Framework. I search a lot in the web but couldn’t get any explanation for it. Okay now, let me explain a bit on this issue.

I installed the latest version of MongoDB 2.2.3 from 10gen repo as well as the latest version-1.3.4 of MongoDB database driver for PHP from PACL. I have already told that application based on Zend Framework 2 with Doctrine Mongo ODM. I checked the error.log file and get this error:

Fatal error: Class 'Doctrine\MongoDB\Util\InvalidArgumentException' not found in /PROJECT_ROOT/vendor/doctrine/mongodb/lib/Doctrine/MongoDB/Util/ReadPreference.php on line ..(any line number)

More specifically, I was getting the error in the Doctrine\MongoDB\Util\ReadPreference::convertNumericType() function. I was happening for the problem of PHP mongo driver. But it shouldn’t be happened. Because, I was already using the latest version of it. Start googling it. Unluckily I didn’t get any proper solution for it. But got some hits. According to those hints I downgrade the mongo driver to v-1.3.2 (stable version). I removed the version 1.3.4 and installed version 1.3.2. Total procedures are below.

Ran the following command to remove existing one

sudo pecl uninstall mongo

Then downloaded the version 1.3.2 and installed manually.Ran following commands.

wget http://pecl.php.net/get/mongo-1.3.2.tgz
sudo tar zxvf mongo-1.3.2.tgz
cd mongo-1.3.2
phpize
./configure
make all
sudo make install

Done. Now, my application run very well. By the way, keep your eyes open that the latest version of mongodb driver will come with bug fixed.

 

Eftakhairul Islam

Hi, I'm Eftakhairul Islam, a passionate Software Engineer, Hacker and Open Source Enthusiast. I enjoy writing about technical things, work in a couple of startup as a technical advisor and in my spare time, I contribute a lot of open source projects.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

 

Read previous post:
Rails 3 “No route matches” error and _method

Since last few days, I am enjoying programing on RoR. But, yesterday, I became cracked for a stupid error. I...

Close