Zend_Session-GlobalSessionManagement.xml 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.session.global_session_management">
  4. <title>Global Session Management</title>
  5. <para>
  6. The default behavior of sessions can be modified using the static methods of
  7. <classname>Zend_Session</classname>. All management and manipulation of global session
  8. management occurs using <classname>Zend_Session</classname>, including configuration of the
  9. <ulink url="http://www.php.net/session#session.configuration">usual options provided by
  10. ext/session</ulink>, using <methodname>Zend_Session::setOptions()</methodname>. For
  11. example, failure to insure the use of a safe <code>save_path</code> or a unique cookie name
  12. by ext/session using <methodname>Zend_Session::setOptions()</methodname> may result in
  13. security issues.
  14. </para>
  15. <sect2 id="zend.session.global_session_management.configuration_options">
  16. <title>Configuration Options</title>
  17. <para>
  18. When the first session namespace is requested, <classname>Zend_Session</classname> will
  19. automatically start the <acronym>PHP</acronym> session, unless already started with
  20. <link
  21. linkend="zend.session.advanced_usage.starting_a_session"><methodname>Zend_Session::start()</methodname></link>.
  22. The underlying <acronym>PHP</acronym> session will use defaults from
  23. <classname>Zend_Session</classname>, unless modified first by
  24. <methodname>Zend_Session::setOptions()</methodname>.
  25. </para>
  26. <para>
  27. To set a session configuration option, include the basename (the part of the name after
  28. "<code>session.</code>") as a key of an array passed to
  29. <methodname>Zend_Session::setOptions()</methodname>. The corresponding value in the
  30. array is used to set the session option value. If no options are set by the developer,
  31. <classname>Zend_Session</classname> will utilize recommended default options first, then
  32. the default php.ini settings. Community feedback about best practices for these options
  33. should be sent to <ulink
  34. url="mailto:fw-auth@lists.zend.com">fw-auth@lists.zend.com</ulink>.
  35. </para>
  36. <example id="zend.session.global_session_management.setoptions.example">
  37. <title>Using Zend_Config to Configure Zend_Session</title>
  38. <para>
  39. To configure this component using <link
  40. linkend="zend.config.adapters.ini"><classname>Zend_Config_Ini</classname></link>,
  41. first add the configuration options to the <acronym>INI</acronym> file:
  42. </para>
  43. <programlisting language="ini"><![CDATA[
  44. ; Accept defaults for production
  45. [production]
  46. ; bug_compat_42
  47. ; bug_compat_warn
  48. ; cache_expire
  49. ; cache_limiter
  50. ; cookie_domain
  51. ; cookie_lifetime
  52. ; cookie_path
  53. ; cookie_secure
  54. ; entropy_file
  55. ; entropy_length
  56. ; gc_divisor
  57. ; gc_maxlifetime
  58. ; gc_probability
  59. ; hash_bits_per_character
  60. ; hash_function
  61. ; name should be unique for each PHP application sharing the same
  62. ; domain name
  63. name = UNIQUE_NAME
  64. ; referer_check
  65. ; save_handler
  66. ; save_path
  67. ; serialize_handler
  68. ; use_cookies
  69. ; use_only_cookies
  70. ; use_trans_sid
  71. ; remember_me_seconds = <integer seconds>
  72. ; strict = on|off
  73. ; Development inherits configuration from production, but overrides
  74. ; several values
  75. [development : production]
  76. ; Don't forget to create this directory and make it rwx (readable and
  77. ; modifiable) by PHP.
  78. save_path = /home/myaccount/zend_sessions/myapp
  79. use_only_cookies = on
  80. ; When persisting session id cookies, request a TTL of 10 days
  81. remember_me_seconds = 864000
  82. ]]></programlisting>
  83. <para>
  84. Next, load the configuration file and pass its array representation to
  85. <methodname>Zend_Session::setOptions()</methodname>:
  86. </para>
  87. <programlisting language="php"><![CDATA[
  88. $config = new Zend_Config_Ini('myapp.ini', 'development');
  89. Zend_Session::setOptions($config->toArray());
  90. ]]></programlisting>
  91. </example>
  92. <para>
  93. Most options shown above need no explanation beyond that found in the standard
  94. <acronym>PHP</acronym> documentation, but those of particular interest are noted below.
  95. <itemizedlist mark="opencircle">
  96. <listitem>
  97. <para>
  98. boolean <code>strict</code> - disables automatic starting of
  99. <classname>Zend_Session</classname> when using
  100. <code>new Zend_Session_Namespace()</code>.
  101. </para>
  102. </listitem>
  103. <listitem>
  104. <para>
  105. integer <code>remember_me_seconds</code> - how long should session id cookie
  106. persist, after user agent has ended (e.g., browser application terminated).
  107. </para>
  108. </listitem>
  109. <listitem>
  110. <para>
  111. string <code>save_path</code> - The correct value is system dependent, and
  112. should be provided by the developer using an
  113. <emphasis>absolute path</emphasis> to a directory readable and writable by
  114. the <acronym>PHP</acronym> process. If a writable path is not supplied, then
  115. <classname>Zend_Session</classname> will throw an exception when started
  116. (i.e., when <methodname>start()</methodname> is called).
  117. </para>
  118. <note>
  119. <title>Security Risk</title>
  120. <para>
  121. If the path is readable by other applications, then session hijacking
  122. might be possible. if the path is writable by other applications, then
  123. <ulink url="http://en.wikipedia.org/wiki/Session_poisoning">session
  124. poisoning</ulink> might be possible. If this path is shared with
  125. other users or other <acronym>PHP</acronym> applications, various
  126. security issues might occur, including theft of session content,
  127. hijacking of sessions, and collision of garbage collection (e.g.,
  128. another user's application might cause <acronym>PHP</acronym> to delete
  129. your application's session files).
  130. </para>
  131. <para>
  132. For example, an attacker can visit the victim's website to obtain a
  133. session cookie. Then, he edits the cookie path to his own domain on the
  134. same server, before visiting his own website to execute
  135. <methodname>var_dump($_SESSION)</methodname>. Armed with detailed
  136. knowledge of the victim's use of data in their sessions, the attacker
  137. can then modify the session state (poisoning the session), alter the
  138. cookie path back to the victim's website, and then make requests from
  139. the victim's website using the poisoned session. Even if two
  140. applications on the same server do not have read/write access to the
  141. other application's <code>save_path</code>, if the
  142. <code>save_path</code> is guessable, and the attacker has control over
  143. one of these two websites, the attacker could alter their website's
  144. <code>save_path</code> to use the other's save_path, and thus accomplish
  145. session poisoning, under some common configurations of
  146. <acronym>PHP</acronym>. Thus, the value for <code>save_path</code>
  147. should not be made public knowledge and should be altered to a secure
  148. location unique to each application.
  149. </para>
  150. </note>
  151. </listitem>
  152. <listitem>
  153. <para>
  154. string <code>name</code> - The correct value is system dependent and should
  155. be provided by the developer using a value <emphasis>unique</emphasis> to
  156. the application.
  157. </para>
  158. <note>
  159. <title>Security Risk</title>
  160. <para>
  161. If the <code>php.ini</code> setting for <code>session.name</code> is the
  162. same (e.g., the default "PHPSESSID"), and there are two or more
  163. <acronym>PHP</acronym> applications accessible through the same domain
  164. name then they will share the same session data for visitors to both
  165. websites. Additionally, possible corruption of session data may result.
  166. </para>
  167. </note>
  168. </listitem>
  169. <listitem>
  170. <para>
  171. boolean <code>use_only_cookies</code> - In order to avoid introducing
  172. additional security risks, do not alter the default value of this option.
  173. <note>
  174. <title>Security Risk</title>
  175. <para>
  176. If this setting is not enabled, an attacker can easily fix victim's
  177. session ids, using links on the attacker's website, such as
  178. <code>http://www.example.com/index.php?PHPSESSID=fixed_session_id</code>.
  179. The fixation works, if the victim does not already have a session id
  180. cookie for example.com. Once a victim is using a known session id,
  181. the attacker can then attempt to hijack the session by pretending to
  182. be the victim, and emulating the victim's user agent.
  183. </para>
  184. </note>
  185. </para>
  186. </listitem>
  187. </itemizedlist>
  188. </para>
  189. </sect2>
  190. <sect2 id="zend.session.global_session_management.headers_sent">
  191. <title>Error: Headers Already Sent</title>
  192. <para>
  193. If you see the error message, "Cannot modify header information - headers already sent",
  194. or, "You must call ... before any output has been sent to the browser; output started in
  195. ...", then carefully examine the immediate cause (function or method) associated with
  196. the message. Any actions that require sending <acronym>HTTP</acronym> headers, such as
  197. sending a cookie, must be done before sending normal output (unbuffered output), except
  198. when using <acronym>PHP</acronym>'s output buffering.
  199. </para>
  200. <itemizedlist mark="opencircle">
  201. <listitem>
  202. <para>
  203. Using <ulink url="http://php.net/outcontrol">output buffering</ulink> often is
  204. sufficient to prevent this issue, and may help improve performance. For example,
  205. in <code>php.ini</code>, "<code>output_buffering = 65535</code>" enables output
  206. buffering with a 64K buffer. Even though output buffering might be a good tactic
  207. on production servers to increase performance, relying only on buffering to
  208. resolve the "headers already sent" problem is not sufficient. The application
  209. must not exceed the buffer size, or the problem will occur whenever the output
  210. sent (prior to the <acronym>HTTP</acronym> headers) exceeds the buffer size.
  211. </para>
  212. </listitem>
  213. <listitem>
  214. <para>
  215. Alternatively, try rearranging the application logic so that actions
  216. manipulating headers are performed prior to sending any output whatsoever.
  217. </para>
  218. </listitem>
  219. <listitem>
  220. <para>
  221. If a <classname>Zend_Session</classname> method is involved in causing the error
  222. message, examine the method carefully, and make sure its use really is needed in
  223. the application. For example, the default usage of
  224. <methodname>destroy()</methodname> also sends an <acronym>HTTP</acronym> header
  225. to expire the client-side session cookie. If this is not needed, then use
  226. <methodname>destroy(false)</methodname>, since the instructions to set cookies
  227. are sent with <acronym>HTTP</acronym> headers.
  228. </para>
  229. </listitem>
  230. <listitem>
  231. <para>
  232. Alternatively, try rearranging the application logic so that all actions
  233. manipulating headers are performed prior to sending any output whatsoever.
  234. </para>
  235. </listitem>
  236. <listitem>
  237. <para>
  238. Remove any closing "<code>?&gt;</code>" tags, if they occur at the end of a
  239. <acronym>PHP</acronym> source file. They are not needed, and newlines and other
  240. nearly invisible whitespace following the closing tag can trigger output to the
  241. client.
  242. </para>
  243. </listitem>
  244. </itemizedlist>
  245. </sect2>
  246. <sect2 id="zend.session.global_session_management.session_identifiers">
  247. <title>Session Identifiers</title>
  248. <para>
  249. Introduction: Best practice in relation to using sessions with Zend Framework calls for
  250. using a browser cookie (i.e. a normal cookie stored in your web browser), instead of
  251. embedding a unique session identifier in <acronym>URL</acronym>s as a means to track
  252. individual users. By default this component uses only cookies to maintain session
  253. identifiers. The cookie's value is the unique identifier of your browser's session.
  254. <acronym>PHP</acronym>'s ext/session uses this identifier to maintain a unique
  255. one-to-one relationship between website visitors, and persistent session data storage
  256. unique to each visitor. <classname>Zend_Session</classname>* wraps this storage
  257. mechanism (<varname>$_SESSION</varname>) with an object-oriented interface.
  258. Unfortunately, if an attacker gains access to the value of the cookie (the session id),
  259. an attacker might be able to hijack a visitor's session. This problem is not unique to
  260. <acronym>PHP</acronym>, or Zend Framework. The <methodname>regenerateId()</methodname>
  261. method allows an application to change the session id (stored in the visitor's cookie)
  262. to a new, random, unpredictable value. Note: Although not the same, to make this section
  263. easier to read, we use the terms "user agent" and "web browser" interchangeably.
  264. </para>
  265. <para>
  266. Why?: If an attacker obtains a valid session identifier, an attacker might be able to
  267. impersonate a valid user (the victim), and then obtain access to confidential
  268. information or otherwise manipulate the victim's data managed by your application.
  269. Changing session ids helps protect against session hijacking. If the session id is
  270. changed, and an attacker does not know the new value, the attacker can not use the new
  271. session id in their attempts to hijack the visitor's session. Even if an attacker gains
  272. access to an old session id, <methodname>regenerateId()</methodname> also moves the
  273. session data from the old session id "handle" to the new one, so no data remains
  274. accessible via the old session id.
  275. </para>
  276. <para>
  277. When to use regenerateId(): Adding <methodname>Zend_Session::regenerateId()</methodname>
  278. to your Zend Framework bootstrap yields one of the safest and most secure ways to
  279. regenerate session id's in user agent cookies. If there is no conditional logic to
  280. determine when to regenerate the session id, then there are no flaws in that logic.
  281. Although regenerating on every request prevents several possible avenues of attack, not
  282. everyone wants the associated small performance and bandwidth cost. Thus, applications
  283. commonly try to dynamically determine situations of greater risk, and only regenerate
  284. the session ids in those situations. Whenever a website visitor's session's privileges
  285. are "escalated" (e.g. a visitor re-authenticates their identity before editing their
  286. personal "profile"), or whenever a security "sensitive" session parameter change occurs,
  287. consider using <methodname>regenerateId()</methodname> to create a new session id. If
  288. you call the <methodname>rememberMe()</methodname> function, then don't use
  289. <methodname>regenerateId()</methodname>, since the former calls the latter. If a user
  290. has successfully logged into your website, use <methodname>rememberMe()</methodname>
  291. instead of <methodname>regenerateId()</methodname>.
  292. </para>
  293. <sect3
  294. id="zend.session.global_session_management.session_identifiers.hijacking_and_fixation">
  295. <title>Session Hijacking and Fixation</title>
  296. <para>
  297. Avoiding <ulink url="http://en.wikipedia.org/wiki/Cross_site_scripting">cross-site
  298. script (XSS) vulnerabilities</ulink> helps preventing session hijacking.
  299. According to <ulink url="http://secunia.com/">Secunia's</ulink> statistics XSS
  300. problems occur frequently, regardless of the languages used to create web
  301. applications. Rather than expecting to never have a XSS problem with an application,
  302. plan for it by following best practices to help minimize damage, if it occurs. With
  303. XSS, an attacker does not need direct access to a victim's network traffic. If the
  304. victim already has a session cookie, Javascript XSS might allow an attacker to read
  305. the cookie and steal the session. for victims with no session cookies, using XSS to
  306. inject Javascript, an attacker could create a session id cookie on the victim's
  307. browser with a known value, then set an identical cookie on the attacker's system,
  308. in order to hijack the victim's session. If the victim visited an attacker's
  309. website, then the attacker can also emulate most other identifiable characteristics
  310. of the victim's user agent. If your website has an XSS vulnerability, the attacker
  311. might be able to insert an <acronym>AJAX</acronym> Javascript that secretly "visits"
  312. the attacker's website, so that the attacker knows the victim's browser
  313. characteristics and becomes aware of a compromised session at the victim website.
  314. However, the attacker can not arbitrarily alter the server-side state of
  315. <acronym>PHP</acronym> sessions, provided the developer has correctly set the value
  316. for the <code>save_path</code> option.
  317. </para>
  318. <para>
  319. By itself, calling <methodname>Zend_Session::regenerateId()</methodname> when the
  320. user's session is first used, does not prevent session fixation attacks, unless you
  321. can distinguish between a session originated by an attacker emulating the victim. At
  322. first, this might sound contradictory to the previous statement above, until we
  323. consider an attacker who first initiates a real session on your website. The session
  324. is "first used" by the attacker, who then knows the result of the initialization
  325. (<methodname>regenerateId()</methodname>). The attacker then uses the new session id
  326. in combination with an XSS vulnerability, or injects the session id via a link on
  327. the attacker's website (works if <code>use_only_cookies = off</code>).
  328. </para>
  329. <para>
  330. If you can distinguish between an attacker and victim using the same session id,
  331. then session hijacking can be dealt with directly. However, such distinctions
  332. usually involve some form of usability tradeoffs, because the methods of distinction
  333. are often imprecise. For example, if a request is received from an IP in a different
  334. country than the IP of the request when the session was created, then the new
  335. request probably belongs to an attacker. Under the following conditions, there might
  336. not be any way for a website application to distinguish between a victim and an
  337. attacker:
  338. <itemizedlist mark='opencircle'>
  339. <listitem>
  340. <para>
  341. attacker first initiates a session on your website to obtain a valid
  342. session id
  343. </para>
  344. </listitem>
  345. <listitem>
  346. <para>
  347. attacker uses XSS vulnerability on your website to create a cookie on
  348. the victim's browser with the same, valid session id (i.e. session
  349. fixation)
  350. </para>
  351. </listitem>
  352. <listitem>
  353. <para>
  354. both the victim and attacker originate from the same proxy farm (e.g.
  355. both are behind the same firewall at a large company, like AOL)
  356. </para>
  357. </listitem>
  358. </itemizedlist>
  359. The sample code below makes it much harder for an attacker to know the current
  360. victim's session id, unless the attacker has already performed the first two steps
  361. above.
  362. </para>
  363. <example
  364. id="zend.session.global_session_management.session_identifiers.hijacking_and_fixation.example">
  365. <title>Session Fixation</title>
  366. <programlisting language="php"><![CDATA[
  367. $defaultNamespace = new Zend_Session_Namespace();
  368. if (!isset($defaultNamespace->initialized)) {
  369. Zend_Session::regenerateId();
  370. $defaultNamespace->initialized = true;
  371. }
  372. ]]></programlisting>
  373. </example>
  374. </sect3>
  375. </sect2>
  376. <sect2 id="zend.session.global_session_management.rememberme">
  377. <title>rememberMe(integer $seconds)</title>
  378. <para>
  379. Ordinarily, sessions end when the user agent terminates, such as when an end user exits
  380. a web browser program. However, your application may provide the ability to extend user
  381. sessions beyond the lifetime of the client program through the use of persistent
  382. cookies. Use <methodname>Zend_Session::rememberMe()</methodname> before a session is
  383. started to control the length of time before a persisted session cookie expires. If you
  384. do not specify a number of seconds, then the session cookie lifetime defaults to
  385. <code>remember_me_seconds</code>, which may be set using
  386. <methodname>Zend_Session::setOptions()</methodname>. To help thwart session
  387. fixation/hijacking, use this function when a user successfully authenticates with your
  388. application (e.g., from a "login" form).
  389. </para>
  390. </sect2>
  391. <sect2 id="zend.session.global_session_management.forgetme">
  392. <title>forgetMe()</title>
  393. <para>
  394. This function complements <methodname>rememberMe()</methodname> by writing a session
  395. cookie that has a lifetime ending when the user agent terminates.
  396. </para>
  397. </sect2>
  398. <sect2 id="zend.session.global_session_management.sessionexists">
  399. <title>sessionExists()</title>
  400. <para>
  401. Use this method to determine if a session already exists for the current user
  402. agent/request. It may be used before starting a session, and independently of all other
  403. <classname>Zend_Session</classname> and <classname>Zend_Session_Namespace</classname>
  404. methods.
  405. </para>
  406. </sect2>
  407. <sect2 id="zend.session.global_session_management.destroy">
  408. <title>destroy(bool $remove_cookie = true, bool $readonly = true)</title>
  409. <para>
  410. <methodname>Zend_Session::destroy()</methodname> destroys all of the persistent data
  411. associated with the current session. However, no variables in <acronym>PHP</acronym> are
  412. affected, so your namespaced sessions (instances of
  413. <classname>Zend_Session_Namespace</classname>) remain readable. To complete a "logout",
  414. set the optional parameter to <constant>TRUE</constant> (the default) to also delete the
  415. user agent's session id cookie. The optional <varname>$readonly</varname> parameter
  416. removes the ability to create new <classname>Zend_Session_Namespace</classname>
  417. instances and for <classname>Zend_Session</classname> methods to write to the session
  418. data store.
  419. </para>
  420. <para>
  421. If you see the error message, "Cannot modify header information - headers already sent",
  422. then either avoid using <constant>TRUE</constant> as the value for the first argument
  423. (requesting removal of the session cookie), or see <xref
  424. linkend="zend.session.global_session_management.headers_sent" />. Thus,
  425. <methodname>Zend_Session::destroy(true)</methodname> must either be called before
  426. <acronym>PHP</acronym> has sent <acronym>HTTP</acronym> headers, or output buffering
  427. must be enabled. Also, the total output sent must not exceed the set buffer size, in
  428. order to prevent triggering sending the output before the call to
  429. <methodname>destroy()</methodname>.
  430. </para>
  431. <note>
  432. <title>Throws</title>
  433. <para>
  434. By default, <varname>$readonly</varname> is enabled and further actions involving
  435. writing to the session data store will throw an exception.
  436. </para>
  437. </note>
  438. </sect2>
  439. <sect2 id="zend.session.global_session_management.stop">
  440. <title>stop()</title>
  441. <para>
  442. This method does absolutely nothing more than toggle a flag in
  443. <classname>Zend_Session</classname> to prevent further writing to the session data
  444. store. We are specifically requesting feedback on this feature. Potential uses/abuses
  445. might include temporarily disabling the use of
  446. <classname>Zend_Session_Namespace</classname> instances or
  447. <classname>Zend_Session</classname> methods to write to the session data store, while
  448. execution is transferred to view- related code. Attempts to perform actions involving
  449. writes via these instances or methods will throw an exception.
  450. </para>
  451. </sect2>
  452. <sect2 id="zend.session.global_session_management.writeclose">
  453. <title>writeClose($readonly = true)</title>
  454. <para>
  455. Shutdown the session, close writing and detach <varname>$_SESSION</varname> from the
  456. back-end storage mechanism. This will complete the internal data transformation on this
  457. request. The optional <varname>$readonly</varname> boolean parameter can remove write
  458. access by throwing an exception upon any attempt to write to the session via
  459. <classname>Zend_Session</classname> or <classname>Zend_Session_Namespace</classname>.
  460. </para>
  461. <note>
  462. <title>Throws</title>
  463. <para>
  464. By default, <varname>$readonly</varname> is enabled and further actions involving
  465. writing to the session data store will throw an exception. However, some legacy
  466. application might expect <varname>$_SESSION</varname> to remain writable after
  467. ending the session via <methodname>session_write_close()</methodname>. Although not
  468. considered "best practice", the <varname>$readonly</varname> option is available for
  469. those who need it.
  470. </para>
  471. </note>
  472. </sect2>
  473. <sect2 id="zend.session.global_session_management.expiresessioncookie">
  474. <title>expireSessionCookie()</title>
  475. <para>
  476. This method sends an expired session id cookie, causing the client to delete the session
  477. cookie. Sometimes this technique is used to perform a client-side logout.
  478. </para>
  479. </sect2>
  480. <sect2 id="zend.session.global_session_management.savehandler">
  481. <title>setSaveHandler(Zend_Session_SaveHandler_Interface $interface)</title>
  482. <para>
  483. Most developers will find the default save handler sufficient. This method provides an
  484. object-oriented wrapper for <ulink
  485. url="http://php.net/session_set_save_handler"><methodname>session_set_save_handler()</methodname></ulink>.
  486. </para>
  487. </sect2>
  488. <sect2 id="zend.session.global_session_management.namespaceisset">
  489. <title>namespaceIsset($namespace)</title>
  490. <para>
  491. Use this method to determine if a session namespace exists, or if a particular index
  492. exists in a particular namespace.
  493. </para>
  494. <note>
  495. <title>Throws</title>
  496. <para>
  497. An exception will be thrown if <classname>Zend_Session</classname> is not marked as
  498. readable (e.g., before <classname>Zend_Session</classname> has been started).
  499. </para>
  500. </note>
  501. </sect2>
  502. <sect2 id="zend.session.global_session_management.namespaceunset">
  503. <title>namespaceUnset($namespace)</title>
  504. <para>
  505. Use <methodname>Zend_Session::namespaceUnset($namespace)</methodname> to efficiently
  506. remove an entire namespace and its contents. As with all arrays in
  507. <acronym>PHP</acronym>, if a variable containing an array is unset, and the array
  508. contains other objects, those objects will remain available, if they were also stored by
  509. reference in other array/objects that remain accessible via other variables. So
  510. <methodname>namespaceUnset()</methodname> does not perform a "deep" unsetting/deleting
  511. of the contents of the entries in the namespace. For a more detailed explanation, please
  512. see <ulink url="http://php.net/references">References Explained</ulink> in the
  513. <acronym>PHP</acronym> manual.
  514. </para>
  515. <note>
  516. <title>Throws</title>
  517. <para>
  518. An exception will be thrown if the namespace is not writable (e.g., after
  519. <methodname>destroy()</methodname>).
  520. </para>
  521. </note>
  522. </sect2>
  523. <sect2 id="zend.session.global_session_management.namespaceget">
  524. <title>namespaceGet($namespace)</title>
  525. <para>
  526. DEPRECATED: Use <methodname>getIterator()</methodname> in
  527. <classname>Zend_Session_Namespace</classname>. This method returns an array of the
  528. contents of <varname>$namespace</varname>. If you have logical reasons to keep this
  529. method publicly accessible, please provide feedback to the <ulink
  530. url="mailto:fw-auth@lists.zend.com">fw-auth@lists.zend.com</ulink> mail list.
  531. Actually, all participation on any relevant topic is welcome :)
  532. </para>
  533. <note>
  534. <title>Throws</title>
  535. <para>
  536. An exception will be thrown if <classname>Zend_Session</classname> is not marked as
  537. readable (e.g., before <classname>Zend_Session</classname> has been started).
  538. </para>
  539. </note>
  540. </sect2>
  541. <sect2 id="zend.session.global_session_management.getiterator">
  542. <title>getIterator()</title>
  543. <para>
  544. Use <methodname>getIterator()</methodname> to obtain an array containing the names of
  545. all namespaces.
  546. </para>
  547. <note>
  548. <title>Throws</title>
  549. <para>
  550. An exception will be thrown if <classname>Zend_Session</classname> is not marked as
  551. readable (e.g., before <classname>Zend_Session</classname> has been started).
  552. </para>
  553. </note>
  554. </sect2>
  555. </sect1>