equal
deleted
inserted
replaced
12 * obtain it through the world-wide-web, please send an email |
12 * obtain it through the world-wide-web, please send an email |
13 * to license@zend.com so we can send you a copy immediately. |
13 * to license@zend.com so we can send you a copy immediately. |
14 * |
14 * |
15 * @category Zend |
15 * @category Zend |
16 * @package Zend_Stdlib |
16 * @package Zend_Stdlib |
17 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
17 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @license http://framework.zend.com/license/new-bsd New BSD License |
18 * @license http://framework.zend.com/license/new-bsd New BSD License |
19 */ |
19 */ |
20 |
20 |
21 /** |
21 /** |
22 * CallbackHandler |
22 * CallbackHandler |
25 * primarily to allow for lazy-loading and ensuring availability of default |
25 * primarily to allow for lazy-loading and ensuring availability of default |
26 * arguments (currying). |
26 * arguments (currying). |
27 * |
27 * |
28 * @category Zend |
28 * @category Zend |
29 * @package Zend_Stdlib |
29 * @package Zend_Stdlib |
30 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
30 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
31 * @license http://framework.zend.com/license/new-bsd New BSD License |
31 * @license http://framework.zend.com/license/new-bsd New BSD License |
32 */ |
32 */ |
33 class Zend_Stdlib_CallbackHandler |
33 class Zend_Stdlib_CallbackHandler |
34 { |
34 { |
35 /** |
35 /** |
99 require_once 'Zend/Stdlib/Exception/InvalidCallbackException.php'; |
99 require_once 'Zend/Stdlib/Exception/InvalidCallbackException.php'; |
100 throw new Zend_Stdlib_Exception_InvalidCallbackException('Invalid callback provided; not callable'); |
100 throw new Zend_Stdlib_Exception_InvalidCallbackException('Invalid callback provided; not callable'); |
101 } |
101 } |
102 |
102 |
103 // If pecl/weakref is not installed, simply store the callback and return |
103 // If pecl/weakref is not installed, simply store the callback and return |
104 if (!class_exists('WeakRef')) { |
104 set_error_handler(array($this, 'errorHandler'), E_WARNING); |
|
105 $callable = class_exists('WeakRef'); |
|
106 restore_error_handler(); |
|
107 if (!$callable || $this->error) { |
105 $this->callback = $callback; |
108 $this->callback = $callback; |
106 return; |
109 return; |
107 } |
110 } |
108 |
111 |
109 // If WeakRef exists, we want to use it. |
112 // If WeakRef exists, we want to use it. |