/** * Set app environment variables * * @param string $root * @return void */ public static function setEnvVariables($root = '/') { $configs = null; // Set custom handler to catch errors as exceptions set_error_handler(create_function('$severity, $message, $file, $line', 'throw new \\ErrorException($message, $severity, $severity, $file, $line);')); if (file_exists($root . '/.dev.env') && is_readable($root . '/.dev.env')) { $configs = file_get_contents($root . '/.dev.env'); } else { if (file_exists($root . '/.dist.env') && is_readable($root . '/.dist.env')) { $configs = file_get_contents($root . '/.dist.env'); } else { if (file_exists($root . '/.test.env') && is_readable($root . '/.test.env')) { $configs = file_get_contents($root . '/.test.env'); } else { if (file_exists($root . '/.env') && is_readable($root . '/.env')) { $configs = file_get_contents($root . '/.env'); } else { throw new NotFoundException('No configuration file found.'); } } } } if (false === $configs || null !== error_get_last()) { throw new UnreadableException('Configuration not readable.'); } // Restore original error handler restore_error_handler(); $configs = explode("\n", trim($configs)); array_map(function ($config) { // Remove whitespaces $config = preg_replace('(\\s+)', '', $config); // Add as environment variables putenv($config); }, $configs); }
/** * Configures the environment for testing * * Does the following: * * * Loads the phpunit framework (for the web ui) * * Restores exception phpunit error handlers (for cli) * * registeres an autoloader to load test files */ public static function configure_environment($do_whitelist = TRUE, $do_blacklist = TRUE) { // During a webui request we need to manually load PHPUnit if (!class_exists('PHPUnit_Util_Filter', FALSE) and !function_exists('phpunit_autoload')) { try { include_once 'PHPUnit/Autoload.php'; } catch (ErrorException $e) { include_once 'PHPUnit/Framework.php'; } } // Allow PHPUnit to handle exceptions and errors if (Kohana::$is_cli) { restore_exception_handler(); restore_error_handler(); } spl_autoload_register(array('Kohana_Tests', 'autoload')); Kohana_Tests::$cache = ($cache = Kohana::cache('unittest_whitelist_cache')) === NULL ? array() : $cache; // As of PHPUnit v3.5 there are slight differences in the way files are black|whitelisted self::$phpunit_v35 = function_exists('phpunit_autoload'); $config = Kohana::config('unittest'); if ($do_whitelist and $config->use_whitelist) { self::whitelist(); } if ($do_blacklist and count($config['blacklist'])) { Kohana_Tests::blacklist($config->blacklist); } }
/** * 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; }
/** * Stop all active handler * * @return void */ public static function clean() { if (static::$stack) { restore_error_handler(); } static::$stack = array(); }
/** * {@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; }
public function testAppNonRepo() { $app = new Application('Test', '1.2.3'); $app->setAutoExit(false); restore_error_handler(); $this->assertInstanceOf('KevinGH\\Amend\\Command', $app->get('update')); }
/** * Process one expression an enqueue it using the ExprBuilder instance. * * @param ExprBuilder $builder * @param string $field * @param string $expression * @param string $value * * @return ExprBuilder * * @throws ParserException */ public function process(ExprBuilder $builder, $field, $expression, $value) { if (!Expr::isValidExpression($expression)) { throw new ParserException(sprintf('The expression "%s" is not allowed or not exists.', $expression)); } switch ($expression) { case 'between': set_error_handler(function () use($value) { throw new ParserException(sprintf('The value of "between" expression "%s" is not valid.', $value)); }); list($from, $to) = explode('-', $value); restore_error_handler(); return $builder->between($field, $from, $to); case 'paginate': set_error_handler(function () use($value) { throw new ParserException(sprintf('The value of "paginate" expression "%s" is not valid.', $value)); }); list($currentPageNumber, $maxResultsPerPage) = explode('-', $value); restore_error_handler(); return $builder->paginate($currentPageNumber, $maxResultsPerPage); case 'or': return $builder->orx($value); default: return $builder->{$expression}($field, $value); } }
public function __invoke($data) { set_error_handler($this->generateErrorHandler($data)); $parsed = yaml_emit($data); restore_error_handler(); return $parsed; }
/** * Configures the enviroment for testing * * Does the following: * * * Loads the phpunit framework (for the web ui) * * Restores exception phpunit error handlers (for cli) * * registeres an autoloader to load test files */ public static function configure_enviroment($do_whitelist = TRUE, $do_blacklist = TRUE) { if (!class_exists('PHPUnit_Util_Filter', FALSE)) { // Make sure the PHPUnit classes are available require_once 'PHPUnit/Framework.php'; } if (Kohana::$is_cli) { restore_exception_handler(); restore_error_handler(); } spl_autoload_register(array('Kohana_Tests', 'autoload')); Kohana_Tests::$cache = ($cache = Kohana::cache('phpunit_whitelist_cache')) === NULL ? array() : $cache; $config = Kohana::config('phpunit'); if ($do_whitelist and $config->use_whitelist) { self::whitelist(); } if ($do_blacklist and count($config['blacklist'])) { foreach ($config->blacklist as $item) { if (is_dir($item)) { PHPUnit_Util_Filter::addDirectoryToFilter($item); } else { PHPUnit_Util_Filter::addFileToFilter($item); } } } }
/** * Connect to an Oracle database using a persistent connection * * New instances of this class will use the same connection across multiple requests. * * @param string $username * @param string $password * @param string $connectionString * @param string $characterSet * @param int $sessionMode * @return resource * @see http://php.net/manual/en/function.oci-pconnect.php */ protected function connect($username, $password, $connectionString = null, $characterSet = null, $sessionMode = null) { set_error_handler($this->getErrorHandler()); $connection = oci_pconnect($username, $password, $connectionString, $characterSet, $sessionMode); restore_error_handler(); return $connection; }
/** * Tests that the database was properly loaded. */ public function testDatabaseLoaded() { foreach (['user', 'node', 'system', 'update_test_schema'] as $module) { $this->assertEqual(drupal_get_installed_schema_version($module), 8000, SafeMarkup::format('Module @module schema is 8000', ['@module' => $module])); } // Ensure that all {router} entries can be unserialized. If they cannot be // unserialized a notice will be thrown by PHP. $result = \Drupal::database()->query("SELECT name, route from {router}")->fetchAllKeyed(0, 1); // For the purpose of fetching the notices and displaying more helpful error // messages, let's override the error handler temporarily. set_error_handler(function ($severity, $message, $filename, $lineno) { throw new \ErrorException($message, 0, $severity, $filename, $lineno); }); foreach ($result as $route_name => $route) { try { unserialize($route); } catch (\Exception $e) { $this->fail(sprintf('Error "%s" while unserializing route %s', $e->getMessage(), Html::escape($route_name))); } } restore_error_handler(); // Before accessing the site we need to run updates first or the site might // be broken. $this->runUpdates(); $this->assertEqual(\Drupal::config('system.site')->get('name'), 'Site-Install'); $this->drupalGet('<front>'); $this->assertText('Site-Install'); // Ensure that the database tasks have been run during set up. Neither MySQL // nor SQLite make changes that are testable. $database = $this->container->get('database'); if ($database->driver() == 'pgsql') { $this->assertEqual('on', $database->query("SHOW standard_conforming_strings")->fetchField()); $this->assertEqual('escape', $database->query("SHOW bytea_output")->fetchField()); } }
function bootstrap_drupal_configuration() { drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION); // Unset drupal error handler and restore drush's one. restore_error_handler(); parent::bootstrap_drupal_configuration(); }
/** * tearDown method * * @return void */ public function tearDown() { parent::tearDown(); Configure::write('log', true); if ($this->_restoreError) { restore_error_handler(); } }
/** * {@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); } }
/** * Retrieve the current version available remotely. * * @param Updater $updater * @return string|bool */ public function getCurrentRemoteVersion(Updater $updater) { /** Switch remote request errors to HttpRequestExceptions */ set_error_handler(array($updater, 'throwHttpRequestException')); $packageUrl = $this->getApiUrl(); $package = json_decode(humbug_get_contents($packageUrl), true); restore_error_handler(); if (null === $package || json_last_error() !== JSON_ERROR_NONE) { throw new JsonParsingException('Error parsing JSON package data' . (function_exists('json_last_error_msg') ? ': ' . json_last_error_msg() : '')); } $versions = array_keys($package['package']['versions']); $versionParser = new VersionParser($versions); if ($this->getStability() === self::STABLE) { $this->remoteVersion = $versionParser->getMostRecentStable(); } elseif ($this->getStability() === self::UNSTABLE) { $this->remoteVersion = $versionParser->getMostRecentUnstable(); } else { $this->remoteVersion = $versionParser->getMostRecentAll(); } /** * Setup remote URL if there's an actual version to download */ if (!empty($this->remoteVersion)) { $this->remoteUrl = $this->getDownloadUrl($package); } return $this->remoteVersion; }
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); }
function execute() { set_error_handler('exception_error_handler'); $results = false; $msg = array('text' => $this->type() == 'SELECT' ? 'no records' : 'no errors', 'type' => 'good'); try { $results = DB::getConn()->query($this->query, E_USER_NOTICE); } catch (Exception $e) { $msg = array('text' => htmlentities($e->getMessage()), 'type' => 'error'); } restore_error_handler(); $fields = new DataObjectSet(); $records = new DataObjectSet(); if (isset($results) && $results instanceof SS_Query) { foreach ($results as $result) { $record = new DBP_Record(); $data = array(); foreach ($result as $field => $val) { if (!$fields->find('Label', $field)) { $fields->push(new DBP_Field($field)); } $data[$field] = strlen($val) > 64 ? substr($val, 0, 63) . '<span class="truncated">…</span>' : $val; } $record->Data($data); $records->push($record); } } return array('Query' => $this->query, 'Fields' => $fields, 'Records' => $records, 'Message' => $msg); }
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'); }
$this->_prevHdl = set_error_handler(array($this, "_handleNotice")); register_shutdown_function(array($this, "_handleFatal")); } public function remove() { restore_error_handler(); $this->_prevHdl = null;
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()); }
/** * Configures the environment for testing * * Does the following: * * * Loads the phpunit framework (for the web ui) * * Restores exception phpunit error handlers (for cli) * * registeres an autoloader to load test files */ public static function configure_environment($do_whitelist = TRUE, $do_blacklist = TRUE) { restore_exception_handler(); restore_error_handler(); spl_autoload_register(array('Unittest_tests', 'autoload')); Unittest_tests::$cache = ($cache = Kohana::cache('unittest_whitelist_cache')) === NULL ? array() : $cache; }
/** * Initializes configure and runs the bootstrap process. * Bootstrapping includes the following steps: * * - Setup App array in Configure. * - Include app/Config/core.php. * - Configure core cache configurations. * - Load App cache files. * - Include app/Config/bootstrap.php. * - Setup error/exception handlers. * * @param boolean $boot * @return void */ public static function bootstrap($boot = true) { if ($boot) { self::_appDefaults(); if (!(include APP . 'Config' . DS . 'core.php')) { trigger_error(__d('cake_dev', "Can't find application core file. Please create %s, and make sure it is readable by PHP.", APP . 'Config' . DS . 'core.php'), E_USER_ERROR); } App::init(); App::$bootstrapping = false; App::build(); $exception = array('handler' => 'ErrorHandler::handleException'); $error = array('handler' => 'ErrorHandler::handleError', 'level' => E_ALL & ~E_DEPRECATED); self::_setErrorHandlers($error, $exception); if (!(include APP . 'Config' . DS . 'bootstrap.php')) { trigger_error(__d('cake_dev', "Can't find application bootstrap file. Please create %s, and make sure it is readable by PHP.", APP . 'Config' . DS . 'bootstrap.php'), E_USER_ERROR); } restore_error_handler(); self::_setErrorHandlers(self::$_values['Error'], self::$_values['Exception']); // Preload Debugger + String in case of E_STRICT errors when loading files. if (self::$_values['debug'] > 0) { class_exists('Debugger'); class_exists('String'); } } }
static function throwFromError($code, $message, $file, $line) { self::$errors_count++; self::$error_message = $message . ' in ' . $file . ' on line ' . $line; restore_error_handler(); trigger_error(self::$error_message . "\n", E_USER_ERROR); }
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; }
/** * 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); }
/** * @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); } }
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 static function stop() { self::$Enabled = false; error_reporting(E_ALL); restore_error_handler(); register_shutdown_function("exit"); }
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; }