/** * @ignore * @param array $options */ public function prepareEnvironment($options = array()) { if (empty($options['skipErrorHandler'])) { set_error_handler(array('Ip\\Internal\\ErrorHandler', 'ipErrorHandler')); } if (empty($options['skipError'])) { if (ipConfig()->showErrors()) { error_reporting(E_ALL | E_STRICT); ini_set('display_errors', '1'); } else { ini_set('display_errors', '0'); } } if (empty($options['skipSession'])) { if (session_id() == '' && !headers_sent()) { //if session hasn't been started yet session_name(ipConfig()->get('sessionName')); if (!ipConfig()->get('disableHttpOnlySetting')) { ini_set('session.cookie_httponly', 1); } session_start(); } } if (empty($options['skipEncoding'])) { mb_internal_encoding(ipConfig()->get('charset')); } if (empty($options['skipTimezone'])) { date_default_timezone_set(ipConfig()->get('timezone')); //PHP 5 requires timezone to be set. } }
/** * Making the class non-abstract with a protected constructor does a better * job of preventing instantiation than just marking the class as abstract. * * @see start() */ public function __construct(array $configs) { // Quickly initialize some defaults like usePEAR // by adding the $premature flag $this->_optionsInit(true); $this->setOptions($configs); if ($this->opt('logPhpErrors')) { set_error_handler(array('self', 'phpErrors'), E_ALL); } // Check the PHP configuration if (!defined('SIGHUP')) { trigger_error('PHP is compiled without --enable-pcntl directive', E_USER_ERROR); } // Check for CLI if (php_sapi_name() !== 'cli') { trigger_error('You can only create daemon from the command line (CLI-mode)', E_USER_ERROR); } // Check for POSIX if (!function_exists('posix_getpid')) { trigger_error('PHP is compiled without --enable-posix directive', E_USER_ERROR); } // Enable Garbage Collector (PHP >= 5.3) if (function_exists('gc_enable')) { gc_enable(); } // Initialize & check variables if (false === $this->_optionsInit(false)) { if (is_object($this->_option) && is_array($this->_option->errors)) { foreach ($this->_option->errors as $error) { $this->notice($error); } } trigger_error('Crucial options are not set. Review log:', E_USER_ERROR); } }
/** * 処理の読み込みを行う * * @return void */ public static function load() { // E_DEPRECATED 定数 (for PHP < 5.3) // TODO バージョン互換処理に統合したい。 if (!defined('E_DEPRECATED')) { define('E_DEPRECATED', 8192); } // エラーレベル設定 (PHPのログに対する指定であり、以降のエラーハンドリングには影響しない模様) // 開発時は -1 (全て) を推奨 error_reporting(E_ALL & ~E_NOTICE & ~E_USER_NOTICE & ~E_DEPRECATED & ~E_STRICT); if (!(defined('SAFE') && SAFE === true) && !(defined('INSTALL_FUNCTION') && INSTALL_FUNCTION === true)) { // E_USER_ERROR または警告を捕捉した場合のエラーハンドラ set_error_handler(array(__CLASS__, 'handle_warning'), E_USER_ERROR | E_WARNING | E_USER_WARNING | E_CORE_WARNING | E_COMPILE_WARNING); // 実質的に PHP 5.2 以降かで処理が分かれる if (function_exists('error_get_last')) { // E_USER_ERROR 以外のエラーを捕捉した場合の処理用 register_shutdown_function(array(__CLASS__, 'handle_error')); // 以降の処理では画面へのエラー表示は行なわない ini_set('display_errors', 0); } else { // エラー捕捉用の出力バッファリング ob_start(array(__CLASS__, '_fatal_error_handler')); ini_set('display_errors', 1); } } }
protected function execute(InputInterface $input, OutputInterface $output) { $this->input = $input; $this->output = $output; declare (ticks=1); register_shutdown_function(array($this, 'stopCommand')); set_error_handler(array($this, 'errorHandler')); if (function_exists("pcntl_signal")) { pcntl_signal(SIGTERM, [$this, 'stopCommand']); pcntl_signal(SIGINT, [$this, 'stopCommand']); } else { } $this->isDebug = $input->getArgument('isDebug'); $port = $input->getOption('port'); $chat = $this->container->get('app.chat.handler'); $chat->setIsDebug($this->isDebug); $messageManager = new MessageManager($chat); $messageManager->setIsDebug($this->isDebug); $server = IoServer::factory(new HttpServer(new WsServer($messageManager)), $port); if ($this->isDebug) { $redis = $this->container->get('snc_redis.default'); $server->loop->addPeriodicTimer(5, function () use($redis, $messageManager) { $memory = memory_get_usage(); echo "Send messages. Redis value: " . $redis->get('value') . "\r\n"; $info = array(); $info['message'] = "Redis value: " . $redis->get('value') . "; Memory: " . $memory; $info['type'] = 'message'; $info['from'] = 'me'; $messageManager->sendAll(json_encode($info)); }); } $this->logMessage("Start server."); $server->run(); $this->logMessage("Finish execute daemon."); }
/** * Generate Payload Data * * @param array $payload * @param string $container * * @throws ResponderException * * @return string */ public function generate($payload, $container = 'data') { $function = null; $function_list = ['bson_encode', 'MongoDB\\BSON\\fromPHP']; foreach ($function_list as $bson_function) { if (function_exists($bson_function)) { $function = $bson_function; } } if (is_null($function)) { throw new ResponderException('Failed To Generate BSON - Supporting Library Not Available'); // @codeCoverageIgnore } if ($payload) { $prevHandler = set_error_handler(function ($errno, $errstr, $errfile, $errline, $errcontext) { throw new \Exception(); // @codeCoverageIgnore }); try { $bson = $function([$container => $payload]); if (!$bson) { throw new \Exception(); // @codeCoverageIgnore } } catch (\Exception $e) { set_error_handler($prevHandler); throw new ResponderException('Failed To Generate BSON'); } set_error_handler($prevHandler); return $bson; } return ''; }
public function __construct($options) { // we need at least PHP7 if (version_compare(PHP_VERSION, '7.0.0') < 0) { throw new Exception("Foundation require PHP 7 or newer."); } // get all errors error_reporting(E_ALL); set_error_handler([$this, "errorHandler"]); // the application root is foundation directory's upper directory $this->rootpath = $options["rootpath"] ?? "../"; $this->setupApplicationRoot(); // application timezone $this->timezone = $options["timezone"] ?? "UTC"; $this->setupApplicationTimezone(); // environment $this->env = getenv("ENV") ?? "dev"; // application namespace $this->namespace = $options["namespace"] ?? null; if (is_null($this->namespace)) { throw new Exception("App Namespace not given."); } // configure $this->config = (object) (require $this->rootpath . "/config/" . $this->env . ".php"); // register autoloader $this->registerAutoloader(); }
public function main() { $this->_initDb(); $cli = new \Console_CommandLine_Result(); $cli->options = $this->params; $cli->args = array('files' => $this->args); // Check if we can use colors if ($cli->options['color'] === 'auto') { $cli->options['color'] = DIRECTORY_SEPARATOR != '\\' && function_exists('posix_isatty') && @posix_isatty(STDOUT); } else { $cli->options['color'] = filter_var($cli->options['color'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); } if (empty($cli->args['files'])) { $cli->args['files'] = array(ROOT . DS . 'spec'); } if (!($cli->options['verbose'] || $cli->options['debug'])) { set_error_handler(array($this, 'skipWarning'), E_WARNING | E_NOTICE); } if ($cli->options['dump']) { $module = new DrSlump\Spec\Cli\Modules\Dump($cli); $module->run(); } else { $module = new DrSlump\Spec\Cli\Modules\Test($cli); $module->run(); } }
function stringHasController(risingsun\ostring $string, controller $controller) { $pattern = clone $this; $previousErrorHandler = set_error_handler(function ($errno, $errstr) use(&$errorMessage) { $errorMessage = $errstr; return true; }); $match = preg_match($pattern, $string, $matches); set_error_handler($previousErrorHandler); switch (true) { case $match === false: throw new \domainException('Pattern \'' . $this . '\' is not a valid PCRE regular expression: ' . $errorMessage); case !$match: $controller->stringNotMatchPattern($string, $this); break; default: $match = new match($matches[0]); if ($pattern->names) { unset($matches[0]); $pattern->matches = array_slice($matches, 0, sizeof(sizeof($pattern->names) <= sizeof($matches) ? $pattern->names : $matches)); $pattern->names = array_slice($pattern->names, 0, sizeof($pattern->matches)); } $controller->stringMatchPattern($match, $pattern); } return $this; }
public function testFormat() { $container = $this->getContainer(); $extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor'); set_error_handler(array($this, 'handleDeprecation')); $data = $extractor->all(); restore_error_handler(); $result = $container->get('nelmio_api_doc.formatter.simple_formatter')->format($data); if (class_exists('Dunglas\\ApiBundle\\DunglasApiBundle')) { $this->markTestSkipped('There is an issue because of DunglasApiBundle'); $expected = array('/api/other-resources' => array(0 => array('method' => 'GET', 'uri' => '/api/other-resources.{_format}', 'description' => 'List another resource.', 'requirements' => array('_format' => array('requirement' => 'json|xml|html', 'dataType' => '', 'description' => '')), 'response' => array('' => array('dataType' => 'array of objects (JmsTest)', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsTest', 'actualType' => 'collection', 'readonly' => true, 'required' => true, 'default' => true, 'description' => '', 'children' => array('foo' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'bar' => array('dataType' => 'DateTime', 'actualType' => 'datetime', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => true, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'number' => array('dataType' => 'double', 'actualType' => 'float', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'arr' => array('dataType' => 'array', 'actualType' => 'collection', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'nested' => array('dataType' => 'object (JmsNested)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL, 'children' => array('foo' => array('dataType' => 'DateTime', 'actualType' => 'datetime', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => true, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'bar' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => 'baz', 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'baz' => array('dataType' => 'array of integers', 'actualType' => 'collection', 'subType' => 'integer', 'required' => false, 'default' => NULL, 'description' => 'Epic description. With multiple lines.', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'circular' => array('dataType' => 'object (JmsNested)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'parent' => array('dataType' => 'object (JmsTest)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsTest', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL, 'children' => array('foo' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'bar' => array('dataType' => 'DateTime', 'actualType' => 'datetime', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => true, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'number' => array('dataType' => 'double', 'actualType' => 'float', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'arr' => array('dataType' => 'array', 'actualType' => 'collection', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'nested' => array('dataType' => 'object (JmsNested)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'nested_array' => array('dataType' => 'array of objects (JmsNested)', 'actualType' => 'collection', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL))), 'since' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => '0.2', 'untilVersion' => NULL), 'until' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => '0.3'), 'since_and_until' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => '0.4', 'untilVersion' => '0.5'))), 'nested_array' => array('dataType' => 'array of objects (JmsNested)', 'actualType' => 'collection', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL)))), 'resourceDescription' => 'Operations on another resource.', 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false, 'views' => array('default', 'premium')), 1 => array('method' => 'PUT|PATCH', 'uri' => '/api/other-resources/{id}.{_format}', 'description' => 'Update a resource bu ID.', 'requirements' => array('_format' => array('requirement' => 'json|xml|html', 'dataType' => '', 'description' => ''), 'id' => array('requirement' => '', 'dataType' => '', 'description' => '')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false)), '/api/resources' => array(0 => array('method' => 'GET', 'uri' => '/api/resources.{_format}', 'description' => 'List resources.', 'requirements' => array('_format' => array('requirement' => 'json|xml|html', 'dataType' => '', 'description' => '')), 'response' => array('tests' => array('dataType' => 'array of objects (Test)', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\Test', 'actualType' => 'collection', 'readonly' => true, 'required' => true, 'default' => true, 'description' => '', 'children' => array('a' => array('default' => 'nelmio', 'actualType' => 'string', 'subType' => NULL, 'format' => '{length: min: foo}, {not blank}', 'required' => true, 'dataType' => 'string', 'readonly' => NULL), 'b' => array('default' => NULL, 'actualType' => 'datetime', 'subType' => NULL, 'dataType' => 'DateTime', 'readonly' => NULL, 'required' => NULL)))), 'statusCodes' => array(200 => array(0 => 'Returned on success.'), 404 => array(0 => 'Returned if resource cannot be found.')), 'resourceDescription' => 'Operations on resource.', 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false, 'views' => array('test', 'premium', 'default')), 1 => array('method' => 'POST', 'uri' => '/api/resources.{_format}', 'description' => 'Create a new resource.', 'parameters' => array('a' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'default' => NULL, 'required' => true, 'description' => 'Something that describes A.', 'readonly' => false), 'b' => array('dataType' => 'float', 'actualType' => 'float', 'subType' => NULL, 'default' => NULL, 'required' => true, 'description' => NULL, 'readonly' => false), 'c' => array('dataType' => 'choice', 'actualType' => 'choice', 'subType' => NULL, 'default' => NULL, 'required' => true, 'description' => NULL, 'readonly' => false, 'format' => '{"x":"X","y":"Y","z":"Z"}'), 'd' => array('dataType' => 'datetime', 'actualType' => 'datetime', 'subType' => NULL, 'default' => NULL, 'required' => true, 'description' => NULL, 'readonly' => false), 'e' => array('dataType' => 'date', 'actualType' => 'date', 'subType' => NULL, 'default' => NULL, 'required' => true, 'description' => NULL, 'readonly' => false), 'g' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'default' => NULL, 'required' => true, 'description' => NULL, 'readonly' => false)), 'requirements' => array('_format' => array('requirement' => 'json|xml|html', 'dataType' => '', 'description' => '')), 'response' => array('foo' => array('dataType' => 'DateTime', 'actualType' => 'datetime', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => true, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'bar' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => 'baz', 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'baz' => array('dataType' => 'array of integers', 'actualType' => 'collection', 'subType' => 'integer', 'required' => false, 'default' => NULL, 'description' => 'Epic description. With multiple lines.', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'circular' => array('dataType' => 'object (JmsNested)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL, 'children' => array('foo' => array('dataType' => 'DateTime', 'actualType' => 'datetime', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => true, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'bar' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => 'baz', 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'baz' => array('dataType' => 'array of integers', 'actualType' => 'collection', 'subType' => 'integer', 'required' => false, 'default' => NULL, 'description' => 'Epic description. With multiple lines.', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'circular' => array('dataType' => 'object (JmsNested)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'parent' => array('dataType' => 'object (JmsTest)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsTest', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL, 'children' => array('foo' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'bar' => array('dataType' => 'DateTime', 'actualType' => 'datetime', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => true, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'number' => array('dataType' => 'double', 'actualType' => 'float', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'arr' => array('dataType' => 'array', 'actualType' => 'collection', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'nested' => array('dataType' => 'object (JmsNested)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'nested_array' => array('dataType' => 'array of objects (JmsNested)', 'actualType' => 'collection', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL))), 'since' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => '0.2', 'untilVersion' => NULL), 'until' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => '0.3'), 'since_and_until' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => '0.4', 'untilVersion' => '0.5'))), 'parent' => array('dataType' => 'object (JmsTest)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsTest', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL, 'children' => array('foo' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'bar' => array('dataType' => 'DateTime', 'actualType' => 'datetime', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => true, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'number' => array('dataType' => 'double', 'actualType' => 'float', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'arr' => array('dataType' => 'array', 'actualType' => 'collection', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'nested' => array('dataType' => 'object (JmsNested)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'nested_array' => array('dataType' => 'array of objects (JmsNested)', 'actualType' => 'collection', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL))), 'since' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => '0.2', 'untilVersion' => NULL), 'until' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => '0.3'), 'since_and_until' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => '0.4', 'untilVersion' => '0.5')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false, 'views' => array('default', 'premium')), 2 => array('method' => 'DELETE', 'uri' => '/api/resources/{id}.{_format}', 'description' => 'Delete a resource by ID.', 'requirements' => array('_format' => array('requirement' => 'json|xml|html', 'dataType' => '', 'description' => ''), 'id' => array('requirement' => '', 'dataType' => '', 'description' => '')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 3 => array('method' => 'GET', 'uri' => '/api/resources/{id}.{_format}', 'description' => 'Retrieve a resource by ID.', 'requirements' => array('_format' => array('requirement' => 'json|xml|html', 'dataType' => '', 'description' => ''), 'id' => array('requirement' => '', 'dataType' => '', 'description' => '')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false)), '/tests' => array(0 => array('method' => 'GET', 'uri' => '/tests.{_format}', 'description' => 'index action', 'filters' => array('a' => array('dataType' => 'integer'), 'b' => array('dataType' => 'string', 'arbitrary' => array(0 => 'arg1', 1 => 'arg2'))), 'requirements' => array('_format' => array('requirement' => '', 'dataType' => '', 'description' => '')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 1 => array('method' => 'GET', 'uri' => '/tests.{_format}', 'description' => 'index action', 'filters' => array('a' => array('dataType' => 'integer'), 'b' => array('dataType' => 'string', 'arbitrary' => array(0 => 'arg1', 1 => 'arg2'))), 'requirements' => array('_format' => array('requirement' => '', 'dataType' => '', 'description' => '')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 2 => array('method' => 'POST', 'uri' => '/tests.{_format}', 'host' => 'api.test.dev', 'description' => 'create test', 'parameters' => array('a' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'default' => NULL, 'required' => true, 'description' => 'A nice description', 'readonly' => false), 'b' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'default' => NULL, 'required' => false, 'description' => NULL, 'readonly' => false), 'c' => array('dataType' => 'boolean', 'actualType' => 'boolean', 'subType' => NULL, 'default' => false, 'required' => true, 'description' => NULL, 'readonly' => false), 'd' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'default' => 'DefaultTest', 'required' => true, 'description' => NULL, 'readonly' => false)), 'requirements' => array('_format' => array('requirement' => '', 'dataType' => '', 'description' => '')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false, 'views' => array('default', 'premium')), 3 => array('method' => 'POST', 'uri' => '/tests.{_format}', 'host' => 'api.test.dev', 'description' => 'create test', 'parameters' => array('a' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'default' => NULL, 'required' => true, 'description' => 'A nice description', 'readonly' => false), 'b' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'default' => NULL, 'required' => false, 'description' => NULL, 'readonly' => false), 'c' => array('dataType' => 'boolean', 'actualType' => 'boolean', 'subType' => NULL, 'default' => false, 'required' => true, 'description' => NULL, 'readonly' => false), 'd' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'default' => 'DefaultTest', 'required' => true, 'description' => NULL, 'readonly' => false)), 'requirements' => array('_format' => array('requirement' => '', 'dataType' => '', 'description' => '')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false, 'views' => array('default', 'premium'))), '/tests2' => array(0 => array('method' => 'POST', 'uri' => '/tests2.{_format}', 'description' => 'post test 2', 'requirements' => array('_format' => array('requirement' => '', 'dataType' => '', 'description' => '')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false, 'views' => array('default', 'premium'))), 'TestResource' => array(0 => array('method' => 'ANY', 'uri' => '/named-resource', 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false, 'views' => array('default'))), 'others' => array(0 => array('method' => 'POST', 'uri' => '/another-post', 'description' => 'create another test', 'parameters' => array('dependency_type' => array('required' => true, 'readonly' => false, 'description' => '', 'default' => NULL, 'dataType' => 'object (dependency_type)', 'actualType' => 'model', 'subType' => 'dependency_type', 'children' => array('a' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'default' => NULL, 'required' => true, 'description' => 'A nice description', 'readonly' => false)))), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false, 'views' => array('default', 'test')), 1 => array('method' => 'ANY', 'uri' => '/any', 'description' => 'Action without HTTP verb', 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 2 => array('method' => 'ANY', 'uri' => '/any/{foo}', 'description' => 'Action without HTTP verb', 'requirements' => array('foo' => array('requirement' => '', 'dataType' => '', 'description' => '')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 3 => array('method' => 'ANY', 'uri' => '/authenticated', 'https' => false, 'authentication' => true, 'authenticationRoles' => array(0 => 'ROLE_USER', 1 => 'ROLE_FOOBAR'), 'deprecated' => false), 4 => array('method' => 'POST', 'uri' => '/jms-input-test', 'description' => 'Testing JMS', 'parameters' => array('foo' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'bar' => array('dataType' => 'DateTime', 'actualType' => 'datetime', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => true, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'number' => array('dataType' => 'double', 'actualType' => 'float', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'arr' => array('dataType' => 'array', 'actualType' => 'collection', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'nested' => array('dataType' => 'object (JmsNested)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL, 'children' => array('foo' => array('dataType' => 'DateTime', 'actualType' => 'datetime', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => true, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'bar' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => 'baz', 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'baz' => array('dataType' => 'array of integers', 'actualType' => 'collection', 'subType' => 'integer', 'required' => false, 'default' => NULL, 'description' => 'Epic description. With multiple lines.', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'circular' => array('dataType' => 'object (JmsNested)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'parent' => array('dataType' => 'object (JmsTest)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsTest', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL, 'children' => array('foo' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'bar' => array('dataType' => 'DateTime', 'actualType' => 'datetime', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => true, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'number' => array('dataType' => 'double', 'actualType' => 'float', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'arr' => array('dataType' => 'array', 'actualType' => 'collection', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'nested' => array('dataType' => 'object (JmsNested)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'nested_array' => array('dataType' => 'array of objects (JmsNested)', 'actualType' => 'collection', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL))), 'since' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => '0.2', 'untilVersion' => NULL), 'until' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => '0.3'), 'since_and_until' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => '0.4', 'untilVersion' => '0.5'))), 'nested_array' => array('dataType' => 'array of objects (JmsNested)', 'actualType' => 'collection', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL)), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 5 => array('method' => 'GET', 'uri' => '/jms-return-test', 'description' => 'Testing return', 'response' => array('dependency_type' => array('required' => true, 'readonly' => false, 'description' => '', 'default' => NULL, 'dataType' => 'object (dependency_type)', 'actualType' => 'model', 'subType' => 'dependency_type', 'children' => array('a' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'default' => NULL, 'required' => true, 'description' => 'A nice description', 'readonly' => false)))), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 6 => array('method' => 'ANY', 'uri' => '/my-commented/{id}/{page}/{paramType}/{param}', 'description' => 'This method is useful to test if the getDocComment works.', 'documentation' => 'This method is useful to test if the getDocComment works. And, it supports multilines until the first \'@\' char.', 'requirements' => array('id' => array('dataType' => 'int', 'description' => 'A nice comment', 'requirement' => ''), 'page' => array('dataType' => 'int', 'description' => '', 'requirement' => ''), 'paramType' => array('dataType' => 'int', 'description' => 'The param type', 'requirement' => ''), 'param' => array('dataType' => 'int', 'description' => 'The param id', 'requirement' => '')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 7 => array('method' => 'GET', 'uri' => '/popos', 'description' => 'Retrieves the collection of Popo resources.', 'documentation' => 'Gets the collection.', 'response' => array('foo' => array('required' => false, 'description' => '', 'readonly' => false, 'dataType' => 'string')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false, 'resourceDescription' => 'Popo', 'section' => 'Popo'), 8 => array('method' => 'POST', 'uri' => '/popos', 'description' => 'Creates a Popo resource.', 'documentation' => 'Adds an element to the collection.', 'parameters' => array('foo' => array('required' => false, 'description' => '', 'readonly' => false, 'dataType' => 'string')), 'response' => array('foo' => array('required' => false, 'description' => '', 'readonly' => false, 'dataType' => 'string')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false, 'resourceDescription' => 'Popo', 'section' => 'Popo'), 9 => array('method' => 'DELETE', 'uri' => '/popos/{id}', 'description' => 'Deletes the Popo resource.', 'documentation' => 'Deletes an element of the collection.', 'requirements' => array('id' => array('dataType' => 'string', 'description' => '', 'requirement' => '')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false, 'resourceDescription' => 'Popo', 'section' => 'Popo'), 10 => array('method' => 'GET', 'uri' => '/popos/{id}', 'description' => 'Retrieves Popo resource.', 'documentation' => 'Gets an element of the collection.', 'requirements' => array('id' => array('dataType' => 'int', 'description' => '', 'requirement' => '')), 'response' => array('foo' => array('required' => false, 'description' => '', 'readonly' => false, 'dataType' => 'string')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false, 'resourceDescription' => 'Popo', 'section' => 'Popo'), 11 => array('method' => 'PUT', 'uri' => '/popos/{id}', 'description' => 'Replaces the Popo resource.', 'documentation' => 'Replaces an element of the collection.', 'parameters' => array('foo' => array('required' => false, 'description' => '', 'readonly' => false, 'dataType' => 'string')), 'requirements' => array('id' => array('dataType' => 'string', 'description' => '', 'requirement' => '')), 'response' => array('foo' => array('required' => false, 'description' => '', 'readonly' => false, 'dataType' => 'string')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false, 'resourceDescription' => 'Popo', 'section' => 'Popo'), 12 => array('method' => 'ANY', 'uri' => '/return-nested-output', 'response' => array('foo' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'bar' => array('dataType' => 'DateTime', 'actualType' => 'datetime', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => true, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'number' => array('dataType' => 'double', 'actualType' => 'float', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'arr' => array('dataType' => 'array', 'actualType' => 'collection', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'nested' => array('dataType' => 'object (JmsNested)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL, 'children' => array('foo' => array('dataType' => 'DateTime', 'actualType' => 'datetime', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => true, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'bar' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => 'baz', 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'baz' => array('dataType' => 'array of integers', 'actualType' => 'collection', 'subType' => 'integer', 'required' => false, 'default' => NULL, 'description' => 'Epic description. With multiple lines.', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'circular' => array('dataType' => 'object (JmsNested)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'parent' => array('dataType' => 'object (JmsTest)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsTest', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL, 'children' => array('foo' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'bar' => array('dataType' => 'DateTime', 'actualType' => 'datetime', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => true, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'number' => array('dataType' => 'double', 'actualType' => 'float', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'arr' => array('dataType' => 'array', 'actualType' => 'collection', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'nested' => array('dataType' => 'object (JmsNested)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'nested_array' => array('dataType' => 'array of objects (JmsNested)', 'actualType' => 'collection', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL))), 'since' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => '0.2', 'untilVersion' => NULL), 'until' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => '0.3'), 'since_and_until' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => '0.4', 'untilVersion' => '0.5'))), 'nested_array' => array('dataType' => 'array of objects (JmsNested)', 'actualType' => 'collection', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\JmsNested', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL)), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 13 => array('method' => 'ANY', 'uri' => '/secure-route', 'https' => true, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 14 => array('method' => 'ANY', 'uri' => '/yet-another/{id}', 'requirements' => array('id' => array('requirement' => '\\d+', 'dataType' => '', 'description' => '')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 15 => array('method' => 'GET', 'uri' => '/z-action-with-deprecated-indicator', 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => true), 16 => array('method' => 'POST', 'uri' => '/z-action-with-nullable-request-param', 'parameters' => array('param1' => array('required' => false, 'dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'description' => 'Param1 description.', 'readonly' => false)), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 17 => array('method' => 'GET', 'uri' => '/z-action-with-query-param', 'filters' => array('page' => array('requirement' => '\\d+', 'description' => 'Page of the overview.', 'default' => '1')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 18 => array('method' => 'GET', 'uri' => '/z-action-with-query-param-no-default', 'filters' => array('page' => array('requirement' => '\\d+', 'description' => 'Page of the overview.')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 19 => array('method' => 'GET', 'uri' => '/z-action-with-query-param-strict', 'requirements' => array('page' => array('requirement' => '\\d+', 'dataType' => '', 'description' => 'Page of the overview.')), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 20 => array('method' => 'POST', 'uri' => '/z-action-with-request-param', 'parameters' => array('param1' => array('required' => true, 'dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'description' => 'Param1 description.', 'readonly' => false)), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 21 => array('method' => 'ANY', 'uri' => '/z-return-jms-and-validator-output', 'response' => array('bar' => array('default' => NULL, 'actualType' => 'datetime', 'subType' => NULL, 'dataType' => 'DateTime', 'readonly' => NULL, 'required' => NULL), 'objects' => array('default' => NULL, 'actualType' => 'collection', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\Test', 'dataType' => 'array of objects (Test)', 'children' => array('a' => array('default' => 'nelmio', 'actualType' => 'string', 'subType' => NULL, 'format' => '{length: min: foo}, {not blank}', 'required' => true, 'dataType' => 'string', 'readonly' => NULL), 'b' => array('default' => NULL, 'actualType' => 'datetime', 'subType' => NULL, 'dataType' => 'DateTime', 'readonly' => NULL, 'required' => NULL)), 'readonly' => NULL, 'required' => NULL), 'number' => array('dataType' => 'DateTime', 'actualType' => 'datetime', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'related' => array('dataType' => 'object (Test)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\Test', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL, 'children' => array('a' => array('default' => 'nelmio', 'actualType' => 'string', 'subType' => NULL, 'format' => '{length: min: foo}, {not blank}', 'required' => true, 'dataType' => 'string', 'readonly' => NULL), 'b' => array('default' => NULL, 'actualType' => 'datetime', 'subType' => NULL, 'dataType' => 'DateTime', 'readonly' => NULL, 'required' => NULL)))), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 22 => array('method' => 'ANY', 'uri' => '/z-return-selected-parsers-input', 'parameters' => array('a' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'default' => NULL, 'required' => true, 'description' => 'A nice description', 'readonly' => false), 'b' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'default' => NULL, 'required' => false, 'description' => NULL, 'readonly' => false), 'c' => array('dataType' => 'boolean', 'actualType' => 'boolean', 'subType' => NULL, 'default' => false, 'required' => true, 'description' => NULL, 'readonly' => false), 'd' => array('dataType' => 'string', 'actualType' => 'string', 'subType' => NULL, 'default' => 'DefaultTest', 'required' => true, 'description' => NULL, 'readonly' => false)), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 23 => array('method' => 'ANY', 'uri' => '/z-return-selected-parsers-output', 'response' => array('bar' => array('default' => NULL, 'actualType' => 'datetime', 'subType' => NULL, 'dataType' => 'DateTime', 'readonly' => NULL, 'required' => NULL), 'objects' => array('default' => NULL, 'actualType' => 'collection', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\Test', 'dataType' => 'array of objects (Test)', 'children' => array('a' => array('default' => 'nelmio', 'actualType' => 'string', 'subType' => NULL, 'format' => '{length: min: foo}, {not blank}', 'required' => true, 'dataType' => 'string', 'readonly' => NULL), 'b' => array('default' => NULL, 'actualType' => 'datetime', 'subType' => NULL, 'dataType' => 'DateTime', 'readonly' => NULL, 'required' => NULL)), 'readonly' => NULL, 'required' => NULL), 'number' => array('dataType' => 'DateTime', 'actualType' => 'datetime', 'subType' => NULL, 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL), 'related' => array('dataType' => 'object (Test)', 'actualType' => 'model', 'subType' => 'Nelmio\\ApiDocBundle\\Tests\\Fixtures\\Model\\Test', 'required' => false, 'default' => NULL, 'description' => '', 'readonly' => false, 'sinceVersion' => NULL, 'untilVersion' => NULL, 'children' => array('a' => array('default' => 'nelmio', 'actualType' => 'string', 'subType' => NULL, 'format' => '{length: min: foo}, {not blank}', 'required' => true, 'dataType' => 'string', 'readonly' => NULL), 'b' => array('default' => NULL, 'actualType' => 'datetime', 'subType' => NULL, 'dataType' => 'DateTime', 'readonly' => NULL, 'required' => NULL)))), 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 24 => array('method' => 'POST', 'uri' => '/zcached', 'cache' => 60, 'https' => false, 'authentication' => false, 'authenticationRoles' => array(), 'deprecated' => false), 25 => array('method' => 'POST', 'uri' => '/zsecured', 'https' => false, 'authentication' => true, 'authenticationRoles' => array(), 'deprecated' => false))); } else { $expected = (require __DIR__ . '/testFormat-result-no-dunglas.php'); } $this->assertEquals($expected, $result); }
/** * {@inheritdoc} */ protected function write(array $record) { if (!is_resource($this->stream)) { if (!$this->url) { throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().'); } $this->errorMessage = null; set_error_handler(array($this, 'customErrorHandler')); $this->stream = fopen($this->url, 'a'); if ($this->filePermission !== null) { @chmod($this->url, $this->filePermission); } restore_error_handler(); if (!is_resource($this->stream)) { $this->stream = null; throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened: ' . $this->errorMessage, $this->url)); } } if ($this->useLocking) { // ignoring errors here, there's not much we can do about them flock($this->stream, LOCK_EX); } fwrite($this->stream, (string) $record['formatted']); if ($this->useLocking) { flock($this->stream, LOCK_UN); } }
/** * Initialize the timezone. * * This function should be called before any calls to date(). * * @author Olav Morken, UNINETT AS <*****@*****.**> */ public static function initTimezone() { static $initialized = false; if ($initialized) { return; } $initialized = true; $globalConfig = \SimpleSAML_Configuration::getInstance(); $timezone = $globalConfig->getString('timezone', null); if ($timezone !== null) { if (!date_default_timezone_set($timezone)) { throw new \SimpleSAML_Error_Exception('Invalid timezone set in the "timezone" option in config.php.'); } return; } // we don't have a timezone configured /* * The date_default_timezone_get() function is likely to cause a warning. * Since we have a custom error handler which logs the errors with a backtrace, * this error will be logged even if we prefix the function call with '@'. * Instead we temporarily replace the error handler. */ set_error_handler(function () { return true; }); $serverTimezone = date_default_timezone_get(); restore_error_handler(); // set the timezone to the default date_default_timezone_set($serverTimezone); }
/** * Lock the resource * * @param bool $blocking wait until the lock is released * @return bool Returns true if the lock was acquired, false otherwise * @throws IOException If the lock file could not be created or opened */ public function lock($blocking = false) { if ($this->handle) { return true; } // Silence both userland and native PHP error handlers $errorLevel = error_reporting(0); set_error_handler('var_dump', 0); if (!($this->handle = fopen($this->file, 'r'))) { if ($this->handle = fopen($this->file, 'x')) { chmod($this->file, 0444); } elseif (!($this->handle = fopen($this->file, 'r'))) { usleep(100); // Give some time for chmod() to complete $this->handle = fopen($this->file, 'r'); } } restore_error_handler(); error_reporting($errorLevel); if (!$this->handle) { $error = error_get_last(); throw new IOException($error['message'], 0, null, $this->file); } // On Windows, even if PHP doc says the contrary, LOCK_NB works, see // https://bugs.php.net/54129 if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) { fclose($this->handle); $this->handle = null; return false; } return true; }
/** * Collects debug info (sql queries, errors, etc). * @param mixed $uniqueId Id of segment. * @param null $label Label for human. * @return void */ public function collectDebugInfo($uniqueId, $label = null) { if ($label === null) { $label = $uniqueId; } if ($this->exclusiveUserId !== null && $this->getUser()->getId() != $this->exclusiveUserId) { return; } if ($this->enableTimeTracker) { Debug::startTimeLabel($uniqueId); } if ($this->enableErrorHandler) { $this->prevErrorReporting = error_reporting(); error_reporting($this->levelReporting); set_error_handler(function ($code, $message, $file, $line) { if (strpos($file, '/disk/')) { $this->log(array($code, $message, $file, $line)); } }, $this->levelReporting); } if ($this->sqlBehavior & (self::SQL_COUNT | self::SQL_DETECT_LIKE | self::SQL_PRINT_ALL)) { if (empty($this->stackSql)) { $this->connection->startTracker(true); array_push($this->stackSql, array($uniqueId, 0, array())); } else { list($prevLabel, $prevLabelCount, $prevSqlTrackerQueries) = array_pop($this->stackSql); list($countQueries, $sqlTrackerQueries) = $this->getDebugInfoSql(); array_push($this->stackSql, array($prevLabel, $countQueries + $prevLabelCount, array_merge($prevSqlTrackerQueries, $sqlTrackerQueries))); $this->connection->startTracker(true); array_push($this->stackSql, array($uniqueId, 0, array())); } } }
public function routeProvider() { // Have to setup error handler here as well, as PHPUnit calls on // provider methods outside the scope of setUp(). set_error_handler(function ($errno, $errstr) { return stristr($errstr, 'query route deprecated'); }, E_USER_DEPRECATED); return array( 'simple-match' => array( new Query(), 'foo=bar&baz=bat', null, array('foo' => 'bar', 'baz' => 'bat') ), 'empty-match' => array( new Query(), '', null, array() ), 'url-encoded-parameters-are-decoded' => array( new Query(), 'foo=foo%20bar', null, array('foo' => 'foo bar') ), 'nested-params' => array( new Query(), 'foo%5Bbar%5D=baz&foo%5Bbat%5D=foo%20bar', null, array('foo' => array('bar' => 'baz', 'bat' => 'foo bar')) ), ); }
/** +---------------------------------------------------------- * 应用程序初始化 +---------------------------------------------------------- * @access public +---------------------------------------------------------- * @return void +---------------------------------------------------------- */ public static function run() { // 设定错误和异常处理 set_error_handler(array('App', "appError")); set_exception_handler(array('App', "appException")); //[RUNTIME] // 检查项目是否编译过 // 在部署模式下会自动在第一次执行的时候编译项目 if (defined('RUNTIME_MODEL')) { // 运行模式无需载入项目编译缓存 } elseif (is_file(RUNTIME_PATH . '~app.php') && (!is_file(CONFIG_PATH . 'config.php') || filemtime(RUNTIME_PATH . '~app.php') > filemtime(CONFIG_PATH . 'config.php'))) { // 直接读取编译后的项目文件 C(include RUNTIME_PATH . '~app.php'); } else { // 预编译项目 App::build(); } //[/RUNTIME] // 取得模块和操作名称 define('MODULE_NAME', App::getModule()); // Module名称 define('ACTION_NAME', App::getAction()); // Action操作 // 记录应用初始化时间 if (C('SHOW_RUN_TIME')) { $GLOBALS['_initTime'] = microtime(TRUE); } // 执行操作 R(MODULE_NAME, ACTION_NAME); // 保存日志记录 if (C('LOG_RECORD')) { Log::save(); } return; }
/** * Starting the error handler * * @param int $errorLevel */ public static function start($errorLevel = \E_WARNING) { if (!static::$stack) { set_error_handler(array(get_called_class(), 'addError'), $errorLevel); } static::$stack[] = null; }
/** * Capture all errors and send to provided console * * @return mixed Returns a string containing the previously defined error handler (if any) */ public function onError($console, $types = E_ALL) { $this->errorConsole = $console; $this->errorTypes = $types; $this->_conditionalErrorConsole = $this->errorConsole->on('Insight: Show all PHP Errors (except:)'); if ($this->_errorReportingInfo === null) { $this->_errorReportingInfo = self::parseErrorReportingBitmask(error_reporting()); foreach (self::$ERROR_CONSTANTS as $constant => $bit) { switch ($constant) { case 'E_ERROR': case 'E_PARSE': case 'E_CORE_ERROR': case 'E_CORE_WARNING': case 'E_COMPILE_ERROR': case 'E_COMPILE_WARNING': case 'E_STRICT': case 'E_ALL': // ignore for now break; default: $this->_conditionalErrorConsole->on($constant); break; } } } //NOTE: The following errors will not be caught by this error handler: // E_ERROR, E_PARSE, E_CORE_ERROR, // E_CORE_WARNING, E_COMPILE_ERROR, // E_COMPILE_WARNING, E_STRICT return set_error_handler(array($this, '_errorHandler')); }
/** * {@inheritdoc} */ public function setDefaultOptions(OptionsResolverInterface $resolver) { set_error_handler(array('Symfony\\Component\\Form\\Test\\DeprecationErrorHandler', 'handleBC')); $resolver->setDefaults($this->getDefaultOptions(array())); $resolver->addAllowedValues($this->getAllowedOptionValues(array())); restore_error_handler(); }
public static function getContentHtml($title, $leadOnly) { $url = 'http://reading-web-research.wmflabs.org/api/slim/'; if ($leadOnly) { $url .= 'lead/'; } $url .= rawurlencode($title); set_error_handler(function () { throw new Exception('Error at endpoint.'); }, E_WARNING); $resp = file_get_contents($url, false); restore_error_handler(); $json = json_decode($resp); $sections = $json->{'sections'}; if ($leadOnly) { $content = $sections[0]->{'content'}; $continue = Html::element('a', array('id' => 'loot-fold', 'style' => 'clear:both; display: block;', 'href' => '?full=1#continue-from'), 'Continue reading...'); $content .= $continue; } else { $content = ''; foreach ($sections as $key => $section) { if ($key > 0) { $content .= '<h2>' . $section->{'title'} . '</h2>'; } $content .= $section->{'content'}; if ($key === 0) { $content .= '<div id="continue-from"></div>'; } } } return $content; }
/** * Invokes internal PHP function with own error handler. * @param string * @return mixed */ public static function invokeSafe($function, array $args, $onError) { $prev = set_error_handler(function ($severity, $message, $file) use($onError, &$prev, $function) { if ($file === '' && defined('HHVM_VERSION')) { // https://github.com/facebook/hhvm/issues/4625 $file = func_get_arg(5)[1]['file']; } if ($file === __FILE__) { $msg = preg_replace("#^{$function}\\(.*?\\): #", '', $message); if ($onError($msg, $severity) !== FALSE) { return; } } return $prev ? $prev(...func_get_args()) : FALSE; }); try { $res = $function(...$args); restore_error_handler(); return $res; } catch (\Throwable $e) { restore_error_handler(); throw $e; } catch (\Exception $e) { restore_error_handler(); throw $e; } }
function search_for_pattern($search, $limit, $offset, $orderby) { if (!in_array($orderby, array('asc', 'desc'))) { $orderby = 'asc'; } $limit = intval($limit); $offset = intval($offset); if (strlen($search) > 0) { if (!ini_get('safe_mode')) { set_time_limit(0); } // First test that the search and replace strings are valid regex if ($this->regex) { set_error_handler(array(&$this, 'regex_error')); $valid = @preg_match($search, '', $matches); restore_error_handler(); if ($valid === false) { return $this->regex_error; } return $this->find($search, $limit, $offset, $orderby); } else { return $this->find('@' . preg_quote($search, '@') . '@', $limit, $offset, $orderby); } } return __("No search pattern", 'search-regex'); }
function change($data, $input, $output) { $input = strtoupper(trim($input)); $output = strtoupper(trim($output)); if ($input == $output) { return $data; } if ($input == 'UTF-8' && $output == 'ISO-8859-1') { $data = str_replace(array('€', '„', '“'), array('EUR', '"', '"'), $data); } if (function_exists('iconv')) { set_error_handler('acymailing_error_handler_encoding'); $encodedData = iconv($input, $output . "//IGNORE", $data); restore_error_handler(); if (!empty($encodedData) && !acymailing_error_handler_encoding('result')) { return $encodedData; } } if (function_exists('mb_convert_encoding')) { return mb_convert_encoding($data, $output, $input); } if ($input == 'UTF-8' && $output == 'ISO-8859-1') { return utf8_decode($data); } if ($input == 'ISO-8859-1' && $output == 'UTF-8') { return utf8_encode($data); } return $data; }
public function testConsoleEvent() { $dispatcher = new EventDispatcher(); $listener = new DebugHandlersListener(null); $app = $this->getMock('Symfony\\Component\\Console\\Application'); $app->expects($this->once())->method('getHelperSet')->will($this->returnValue(new HelperSet())); $command = new Command(__FUNCTION__); $command->setApplication($app); $event = new ConsoleEvent($command, new ArgvInput(), new ConsoleOutput()); $dispatcher->addSubscriber($listener); $xListeners = array(KernelEvents::REQUEST => array(array($listener, 'configure')), ConsoleEvents::COMMAND => array(array($listener, 'configure'))); $this->assertSame($xListeners, $dispatcher->getListeners()); $exception = null; $eHandler = new ErrorHandler(); set_error_handler(array($eHandler, 'handleError')); set_exception_handler(array($eHandler, 'handleException')); try { $dispatcher->dispatch(ConsoleEvents::COMMAND, $event); } catch (\Exception $exception) { } restore_exception_handler(); restore_error_handler(); if (null !== $exception) { throw $exception; } $xHandler = $eHandler->setExceptionHandler('var_dump'); $this->assertInstanceOf('Closure', $xHandler); $app->expects($this->once())->method('renderException'); $xHandler(new \Exception()); }
/** * @param int $expectedType Expected triggered error type (pass one of PHP's E_* constants) * @param string[] $expectedMessages Expected error messages * @param callable $testCode A callable that is expected to trigger the error messages */ public static function assertErrorsAreTriggered($expectedType, $expectedMessages, $testCode) { if (!is_callable($testCode)) { throw new \InvalidArgumentException(sprintf('The code to be tested must be a valid callable ("%s" given).', gettype($testCode))); } $e = null; $triggeredMessages = array(); try { $prevHandler = set_error_handler(function ($type, $message, $file, $line, $context) use($expectedType, &$triggeredMessages, &$prevHandler) { if ($expectedType !== $type) { return null !== $prevHandler && call_user_func($prevHandler, $type, $message, $file, $line, $context); } $triggeredMessages[] = $message; }); call_user_func($testCode); } catch (\Exception $e) { } catch (\Throwable $e) { } restore_error_handler(); if (null !== $e) { throw $e; } \PHPUnit_Framework_Assert::assertCount(count($expectedMessages), $triggeredMessages); foreach ($triggeredMessages as $i => $message) { \PHPUnit_Framework_Assert::assertContains($expectedMessages[$i], $message); } }
function __construct($_sFeaturePath, $_iPort = 16816) { openlog("cuke4php", LOG_PID, LOG_DAEMON); if (is_file($_sFeaturePath)) { $_sFeaturePath = dirname($_sFeaturePath); } if ($_iPort > 0) { $this->iPort = $_iPort; } else { $this->iPort = 16816; } foreach (self::rglob("*.php", 0, $_sFeaturePath . "/support") as $sFilename) { require_once $sFilename; } set_error_handler(array('PHPUnit_Util_ErrorHandler', 'handleError'), E_ALL | E_STRICT); require_once "Cucumber.php"; foreach (self::rglob("*.php", 0, $_sFeaturePath . "/step_definitions") as $sFilename) { require_once $sFilename; } $this->aStepClasses = CucumberSteps::getSubclasses(); foreach ($this->aStepClasses as $sClass) { $oReflection = new ReflectionClass($sClass); $aMethods = $oReflection->getMethods(); foreach ($aMethods as $oMethod) { $sComment = $oMethod->getDocComment(); $aMatches = array(); $aMethod = array(); $aMethod['method'] = $oMethod->name; $aMethod['class'] = $oMethod->class; $aMethod['filename'] = $oMethod->getFileName(); $aMethod['startline'] = $oMethod->getStartLine(); if (substr($oMethod->name, 0, 4) === "step") { preg_match("/(?:Given|When|Then) (.+)\$/im", $sComment, $aMatches); $aMethod['regexp'] = $aMatches[1]; $this->aWorld['steps'][] = $aMethod; continue; } preg_match("/(@.+)/im", $sComment, $aMatches); if (array_key_exists(1, $aMatches)) { $aMethod['tags'] = explode(" ", str_replace("@", "", $aMatches[1])); } else { $aMethod['tags'] = array(); } if (substr($oMethod->name, 0, 6) === "before") { $this->aWorld['before'][] = $aMethod; continue; } if (substr($oMethod->name, 0, 5) === "after") { $this->aWorld['after'][] = $aMethod; continue; } if (substr($oMethod->name, 0, 9) == "transform") { preg_match("/(?:Transform) (.+)\$/im", $sComment, $aMatches); $aMethod['regexp'] = $aMatches[1]; $this->aWorld['transform'][] = $aMethod; continue; } } } }
/** * @param array $params * @param string $username * @param string $password * @param array $driverOptions * * @throws \Doctrine\DBAL\Driver\Mysqli\MysqliException */ public function __construct(array $params, $username, $password, array $driverOptions = array()) { $port = isset($params['port']) ? $params['port'] : ini_get('mysqli.default_port'); // Fallback to default MySQL port if not given. if (!$port) { $port = 3306; } $socket = isset($params['unix_socket']) ? $params['unix_socket'] : ini_get('mysqli.default_socket'); $dbname = isset($params['dbname']) ? $params['dbname'] : null; $flags = isset($driverOptions[static::OPTION_FLAGS]) ? $driverOptions[static::OPTION_FLAGS] : null; $this->_conn = mysqli_init(); $this->setDriverOptions($driverOptions); $previousHandler = set_error_handler(function () { }); if (!$this->_conn->real_connect($params['host'], $username, $password, $dbname, $port, $socket, $flags)) { set_error_handler($previousHandler); $sqlState = 'HY000'; if (@$this->_conn->sqlstate) { $sqlState = $this->_conn->sqlstate; } throw new MysqliException($this->_conn->connect_error, $sqlState, $this->_conn->connect_errno); } set_error_handler($previousHandler); if (isset($params['charset'])) { $this->_conn->set_charset($params['charset']); } }
public function tokenizeHTML($html, $config, &$context) { $html = $this->normalize($html, $config, $context); // attempt to armor stray angled brackets that cannot possibly // form tags and thus are probably being used as emoticons if ($config->get('Core', 'AggressivelyFixLt')) { $char = '[^a-z!\\/]'; $comment = "/<!--(.*?)(-->|\\z)/is"; $html = preg_replace_callback($comment, array('HTMLPurifier_Lexer_DOMLex', 'callbackArmorCommentEntities'), $html); $html = preg_replace("/<({$char})/i", '<\\1', $html); $html = preg_replace_callback($comment, array('HTMLPurifier_Lexer_DOMLex', 'callbackUndoCommentSubst'), $html); // fix comments } // preprocess html, essential for UTF-8 $html = $this->wrapHTML($html, $config, $context); $doc = new DOMDocument(); $doc->encoding = 'UTF-8'; // theoretically, the above has this covered set_error_handler(array($this, 'muteErrorHandler')); $doc->loadHTML($html); restore_error_handler(); $tokens = array(); $this->tokenizeDOM($doc->getElementsByTagName('html')->item(0)->getElementsByTagName('body')->item(0)->getElementsByTagName('div')->item(0), $tokens); return $tokens; }
public function testRegister() { $handler = ErrorHandler::register(); try { $this->assertInstanceOf('Symfony\\Component\\Debug\\ErrorHandler', $handler); $this->assertSame($handler, ErrorHandler::register()); $newHandler = new ErrorHandler(); $this->assertSame($newHandler, ErrorHandler::register($newHandler, false)); $h = set_error_handler('var_dump'); restore_error_handler(); $this->assertSame(array($handler, 'handleError'), $h); try { $this->assertSame($newHandler, ErrorHandler::register($newHandler, true)); $h = set_error_handler('var_dump'); restore_error_handler(); $this->assertSame(array($newHandler, 'handleError'), $h); } catch (\Exception $e) { } restore_error_handler(); restore_exception_handler(); if (isset($e)) { throw $e; } } catch (\Exception $e) { } restore_error_handler(); restore_exception_handler(); if (isset($e)) { throw $e; } }
public static function getAsJson($file, $force = false) { $json = array(); getimagesize($file, $info); if (isset($info["APP13"])) { $iptc = iptcparse($info["APP13"]); if (isset($iptc['2#120'])) { $caption = implode('|', $iptc['2#120']); // nb: '|' should never actually appear $caption = ensureUTF8($caption); // since could be 'local' encoding $caption = mysql_escape_string($caption); // safety. stackoverflow.com/q/1162491 $json['caption'] = $caption; } if (isset($iptc['2#025'])) { $json['keywords'] = $iptc['2#025']; } // keep as array set_error_handler("ignoreAnyError", E_ALL); // TOTEST, currently no exif enabled on localhost if (function_exists('exif_read_data')) { $json['exif'] = exif_read_data($tmpfile, 0, false); } // fails on a very few files (corrupt EXIF) restore_error_handler(); } Log::info("json for :" . $file); Log::info($json); return $json; }
function procesar() { toba::logger_ws()->debug('Servicio Llamado: ' . $this->info['basica']['item']); toba::logger_ws()->set_checkpoint(); set_error_handler('toba_logger_ws::manejador_errores_recuperables', E_ALL); $this->validar_componente(); //-- Pide los datos para construir el componente, WSF no soporta entregar objetos creados $clave = array(); $clave['proyecto'] = $this->info['objetos'][0]['objeto_proyecto']; $clave['componente'] = $this->info['objetos'][0]['objeto']; list($tipo, $clase, $datos) = toba_constructor::get_runtime_clase_y_datos($clave, $this->info['objetos'][0]['clase'], false); agregar_dir_include_path(toba_dir() . '/php/3ros/wsf'); $opciones_extension = toba_servicio_web::_get_opciones($this->info['basica']['item'], $clase); $wsdl = strpos($_SERVER['REQUEST_URI'], "?wsdl") !== false; $sufijo = 'op__'; $metodos = array(); $reflexion = new ReflectionClass($clase); foreach ($reflexion->getMethods() as $metodo) { if (strpos($metodo->name, $sufijo) === 0) { $servicio = substr($metodo->name, strlen($sufijo)); $prefijo = $wsdl ? '' : '_'; $metodos[$servicio] = $prefijo . $metodo->name; } } $opciones = array(); $opciones['serviceName'] = $this->info['basica']['item']; $opciones['classes'][$clase]['operations'] = $metodos; $opciones = array_merge($opciones, $opciones_extension); $this->log->debug("Opciones del servidor: " . var_export($opciones, true), 'toba'); $opciones['classes'][$clase]['args'] = array($datos); toba::logger_ws()->set_checkpoint(); $service = new WSService($opciones); $service->reply(); $this->log->debug("Fin de servicio web", 'toba'); }