PHP Error: unserialize() [function.unserialize]: Error at offset 118 of 512

Lately I got this error in my script while trying to decode serialized UTF-8 string:

unserialize() [function.unserialize]: Error at offset 118 of 512

Here’s a simple solution I found.

Solution to jQuery error: “this.empty is not a function”

A few days ago I was working on a quite complex editor written almost entirely in JavaScript using jQuery library. At some point I noticed a weird error in Firefox error console: “this.empty is not a function”.
The error description is quite confusing so it took a few seconds to realize what’s wrong…

jQuery error: this[0].ownerDocument is null

Recently I found a weird problem with my code. Firefox error console informed me that:

this[0].ownerDocument is null

and that this problem occurs on line 19 of the jquery.js.

PHP: How to safely include file with possible parse errors?

Recently I had written a class and it had to save bits of information somewhere. I wanted to make the script installable just by placing it on a server so I didn’t want to use any database. Instead I figured out I should save the data in a simple file. I could use serialize and file_put_contents which is very easy to write, but modifying such files manually in a text editor is a nightmare. So I decided to save the contents in a PHP file.
Unfortunately if there is an error in such file you will get parse error when including it.

Magento Error: Method Varien_Object::__tostring() cannot take arguments

If you encountered a bug in Magento that says:
Method Varien_Object::__tostring() cannot take arguments
and you have PHP 5.3 or newer then you have 2 options:
1) downgrade to PHP 2.9
2) fix the bugs

PHP Error: Fatal error: Unable to read X bytes in Y.php on line 0

“Fatal error: Unable to read X bytes in Y.php on line 0″ is an error I got once after moving a site to another server. The file was encoded with Zend Optimizer so I could not check what is happening on line 0 that could make any problems.

Internal server error after placing php_value in .htaccess file?

I was recently moving a website to another server and I found out that after saving text into DB all the quotation marks were preceded by slashes.

This mean the “magic_quotes_gpc” option is enabled in the configuration file.

Here’s how to fix this behavior.

PHP Error “headers already sent”

If got an error like this one:

Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at E:\websites\index.php:3) in E:\websites\index.php on line 5

it means you tried to change headers of the file after sending the content of the file.

Parse error: parse error, expecting `T_PAAMAYIM_NEKUDOTAYIM’

I just got this error. After doing some googling I found an explanation in Wikipedia:

“In PHP, the scope resolution operator is also called Paamayim Nekudotayim, which means “twice colon” or “double colon” in Hebrew. It may be helpful to note that in some cases this error may occur when the $ symbol is not included in the use of a variable.”

 
TopOfBlogs Web Development & Design Blogs