Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ad8c8d0

Browse filesBrowse files
committed
add PHP errors options to XML schema definition
1 parent b3fc3b5 commit ad8c8d0
Copy full SHA for ad8c8d0

File tree

Expand file treeCollapse file tree

8 files changed

+68
-0
lines changed
Filter options
Expand file treeCollapse file tree

8 files changed

+68
-0
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<xsd:element name="property-info" type="property_info" minOccurs="0" maxOccurs="1" />
3030
<xsd:element name="cache" type="cache" minOccurs="0" maxOccurs="1" />
3131
<xsd:element name="workflow" type="workflow" minOccurs="0" maxOccurs="unbounded" />
32+
<xsd:element name="php-errors" type="php-errors" minOccurs="0" maxOccurs="1" />
3233
<xsd:element name="lock" type="lock" minOccurs="0" maxOccurs="1" />
3334
<xsd:element name="messenger" type="messenger" minOccurs="0" maxOccurs="1" />
3435
</xsd:choice>
@@ -285,6 +286,11 @@
285286
<xsd:attribute name="enabled" type="xsd:boolean" />
286287
</xsd:complexType>
287288

289+
<xsd:complexType name="php-errors">
290+
<xsd:attribute name="log" type="xsd:boolean" />
291+
<xsd:attribute name="throw" type="xsd:boolean" />
292+
</xsd:complexType>
293+
288294
<xsd:complexType name="marking_store">
289295
<xsd:sequence>
290296
<xsd:element name="argument" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', array(
4+
'php_errors' => array(
5+
'log' => false,
6+
'throw' => false,
7+
),
8+
));
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', array(
4+
'php_errors' => array(
5+
'log' => true,
6+
'throw' => true,
7+
),
8+
));
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" ?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
<framework:php-errors log="false" throw="false" />
10+
</framework:config>
11+
</container>
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" ?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
<framework:php-errors log="true" throw="true" />
10+
</framework:config>
11+
</container>
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
framework:
2+
php_errors:
3+
throw: false
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
framework:
2+
php_errors:
3+
log: true
4+
throw: true

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use Symfony\Component\DependencyInjection\ChildDefinition;
2929
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
3030
use Symfony\Component\DependencyInjection\ContainerBuilder;
31+
use Symfony\Component\DependencyInjection\ContainerInterface;
3132
use Symfony\Component\DependencyInjection\Definition;
3233
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
3334
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
@@ -335,6 +336,22 @@ public function testWorkflowServicesCanBeEnabled()
335336
$this->assertTrue($container->hasDefinition('console.command.workflow_dump'));
336337
}
337338

339+
public function testEnabledPhpErrorsConfig()
340+
{
341+
$container = $this->createContainerFromFile('php_errors_enabled');
342+
343+
$this->assertEquals(new Reference('logger', ContainerInterface::NULL_ON_INVALID_REFERENCE), $container->getDefinition('debug.debug_handlers_listener')->getArgument(1));
344+
$this->assertSame(-1, $container->getParameter('debug.error_handler.throw_at'));
345+
}
346+
347+
public function testDisabledPhpErrorsConfig()
348+
{
349+
$container = $this->createContainerFromFile('php_errors_disabled');
350+
351+
$this->assertNull($container->getDefinition('debug.debug_handlers_listener')->getArgument(1));
352+
$this->assertSame(0, $container->getParameter('debug.error_handler.throw_at'));
353+
}
354+
338355
public function testRouter()
339356
{
340357
$container = $this->createContainerFromFile('full');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.