Skip to content

Commit 62f3a29

Browse files
committed
bug symfony#13420 [Debug] fix loading order for legacy classes (nicolas-grekas)
This PR was merged into the 2.3 branch. Discussion ---------- [Debug] fix loading order for legacy classes | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#13416 | License | MIT | Doc PR | - Looks like declaration order is important. Commits ------- cb34789 [Debug] fix loading order for legacy classes
2 parents 760ad33 + cb34789 commit 62f3a29

File tree

2 files changed

+48
-40
lines changed

2 files changed

+48
-40
lines changed

src/Symfony/Component/Debug/Exception/FatalErrorException.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Component\Debug\Exception;
13-
14-
use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
12+
namespace Symfony\Component\HttpKernel\Exception;
1513

1614
/**
1715
* Fatal Error Exception.
1816
*
1917
* @author Konstanton Myakshin <[email protected]>
18+
*
19+
* @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead.
2020
*/
21-
class FatalErrorException extends LegacyFatalErrorException
21+
class FatalErrorException extends \ErrorException
2222
{
2323
}
2424

25-
namespace Symfony\Component\HttpKernel\Exception;
25+
namespace Symfony\Component\Debug\Exception;
26+
27+
use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
2628

2729
/**
2830
* Fatal Error Exception.
2931
*
3032
* @author Konstanton Myakshin <[email protected]>
31-
*
32-
* @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead.
3333
*/
34-
class FatalErrorException extends \ErrorException
34+
class FatalErrorException extends LegacyFatalErrorException
3535
{
3636
}

src/Symfony/Component/Debug/Exception/FlattenException.php

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,46 @@
99
* file that was distributed with this source code.
1010
*/
1111

12+
namespace Symfony\Component\HttpKernel\Exception;
13+
14+
use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
15+
16+
/**
17+
* FlattenException wraps a PHP Exception to be able to serialize it.
18+
*
19+
* Basically, this class removes all objects from the trace.
20+
*
21+
* @author Fabien Potencier <[email protected]>
22+
*
23+
* @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead.
24+
*/
25+
class FlattenException
26+
{
27+
private $handler;
28+
29+
public static function __callStatic($method, $args)
30+
{
31+
if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
32+
throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_called_class(), $method));
33+
}
34+
35+
return call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
36+
}
37+
38+
public function __call($method, $args)
39+
{
40+
if (!isset($this->handler)) {
41+
$this->handler = new DebugFlattenException();
42+
}
43+
44+
if (!method_exists($this->handler, $method)) {
45+
throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_class($this), $method));
46+
}
47+
48+
return call_user_func_array(array($this->handler, $method), $args);
49+
}
50+
}
51+
1252
namespace Symfony\Component\Debug\Exception;
1353

1454
use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
@@ -279,35 +319,3 @@ private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
279319
return $array['__PHP_Incomplete_Class_Name'];
280320
}
281321
}
282-
283-
namespace Symfony\Component\HttpKernel\Exception;
284-
285-
use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
286-
287-
/**
288-
* FlattenException wraps a PHP Exception to be able to serialize it.
289-
*
290-
* Basically, this class removes all objects from the trace.
291-
*
292-
* @author Fabien Potencier <[email protected]>
293-
*
294-
* @deprecated Deprecated in 2.3, to be removed in 3.0. Use the same class from the Debug component instead.
295-
*/
296-
class FlattenException
297-
{
298-
private $handler;
299-
300-
public static function __callStatic($method, $args)
301-
{
302-
return forward_static_call_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
303-
}
304-
305-
public function __call($method, $args)
306-
{
307-
if (!isset($this->handler)) {
308-
$this->handler = new DebugFlattenException();
309-
}
310-
311-
return call_user_func_array(array($this->handler, $method), $args);
312-
}
313-
}

0 commit comments

Comments
 (0)