Index: library/Zend/Session/Namespace.php =================================================================== --- library/Zend/Session/Namespace.php (revision 13200) +++ library/Zend/Session/Namespace.php (working copy) @@ -98,6 +98,14 @@ throw new Zend_Session_Exception('Session namespace must not start with an underscore.'); } + if (preg_match('#(^[0-9])#i', $namespace[0])) { + /** + * @see Zend_Session_Exception + */ + require_once 'Zend/Session/Exception.php'; + throw new Zend_Session_Exception('Session namespace must not start with a number.'); + } + if (isset(self::$_singleInstances[$namespace])) { /** * @see Zend_Session_Exception Index: tests/Zend/Session/SessionTest.php =================================================================== --- tests/Zend/Session/SessionTest.php (revision 13200) +++ tests/Zend/Session/SessionTest.php (working copy) @@ -375,6 +375,23 @@ } /** + * test for detection of illegal namespace names; expect exception complaining about name beginning + * with an underscore + * + * @return void + */ + public function testInitNamespaceNumber() + { + try { + $s = new Zend_Session_Namespace('0namespace'); + $this->fail('No exception was returned when requesting a namespace having a name beginning with ' + . 'a number'); + } catch (Zend_Session_Exception $e) { + $this->assertRegexp('/number/i', $e->getMessage()); + } + } + + /** * test iteration; expect native PHP foreach statement is able to properly iterate all items in a session namespace * * @return void