Can’t save customer – call_user_func Zend Validate Hostname Com getCharacters

Thursday, 18. October 2012

A rather strange error on live server happened when customers try to register an account they get and error message “Can’t save customer”.

After a bit of digging and throwing lots of exceptions – came to find the solution as explained below..

** HANG ON – Ideally you will want to make these changes on your local folder. Please don’t edit the core files **

Go to file: lib/Zend/Validate.

Scroll down to around line 324 where you will spot a script similar to:

...
     if (Zend_Loader::isReadable($classFile)) {

Replace that line with:

... 
     if (file_exists($classFile) && Zend_Loader::isReadable($classFile)) { 
      # added: file_exists($classFile) &&

Apply Zend Security Patch To Magento Installation Via SSH

Thursday, 19. July 2012

Here is a nice and quick way to apply the Zend Security Patch to your Magento install via SSH (command terminal)

Note:
Patch is only necessary for the versions less than CE Magento 1.7.0.2
This solution is for Magento CE 1.5.0.0 to 1.7.0.1. Change the patch file to match your version. More info here:
important-security-update-zend-platform-vulnerability

Command Line script

wget http://www.magentocommerce.com/downloads/assets/1.7.0.2/CE_1.5.0.0-1.7.0.1.patch && patch -p0 -i CE_1.5.0.0-1.7.0.1.patch

Enjoy!

Only variables should be passed by reference in lib_Zend_Db_Select line 246

Wednesday, 13. June 2012

Had this strange error today while doing a database backup via Magento admin

Strict Notice: Only variables should be passed by reference  in ../lib/Zend/Db/Select.php on line 246
Trace:
#0 ../lib/Zend/Db/Select.php(246): mageCoreErrorHandler(2048, 'Only variables ...', '/var/www/client...', 246, Array)
...

After a bit of digging around, the issue was simply solved by doing the following:

– Navigate to: /lib/Zend/Db/Select.php and go to live 246

Find:

$correlationName = current(array_keys($this->_parts[self::FROM]));

– Replace that with

$correlationName = array_keys($this->_parts[self::FROM]);
$correlationName = $correlationName[0];

Please NOTE:
You have just edited the core file there. I will recommend you take a note of this for future reference.

Zend_Cache_Exception can’t get apc memory size

Thursday, 12. April 2012

trying to run Magento indexes on command line is an excellent way to get things done rather quickly. However there are times it can be rather annoying and more so when performance enhancement measueruses such as APC cache is in place.

A common error with APC cache exception ‘Zend_Cache_Exception’ with message ‘can’t get apc memory size’ in lib/Zend/Cache.php:209 can be very annoying and if like me you have been scratching your head over this, the post may be your solution.

After soul searching I came to find out this is merely a configurations issue and the most common settings you need are these below.

 
extension=apc.so
apc.shm_size=512
apc.num_files_hint=10000
apc.user_entries_hint=10000
apc.max_file_size=5M
apc.enable_cli=1    # VERY IMPORTANT

You will need to add these entries to your apc.ini file that can be found (at least on my server)

/etc/php5/conf.d/apc.ini

REMEMBER you will need to restart apache for these changes to take effect.

Enjoy