zendframework/zf2 — pull request #891 by padraic (2012-03-06 19:19:54+00:00)
Title: Updated checks on setEncoding() to offset two issues

1. htmlspecialchars silently accepts blank strings in PHP 5.3 and uses default encoding (PHP 5.4 guesses or uses php.ini default_charset setting)
2. Setting invalid encoding in htmlspecialchars issues warning level error but continues to escape anyway using default encoding (think if display_errors off...)

This change throws an exception on a blank encoding or an encoding invalid for htmlspecialchars to tighten up this behaviour and discourage insecure coding.