After hours of revising my code to find the error, i finally found the least expected error, bzcompress fails often ! and that is the error
bzcompress under PHP 5.x failed with error code -3, unfortunately, there is no documentation on what that may be, or at least i can not find it.
To fix my application, i tested the data in the resulting variable with the is_numeric function, and if that had the value of TRUE, i used a flag with the data to denote compression.
I will update this post as soon as i have more information on this matter