This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/zendframework/zf2 into ad…
…d_maxlength_to_param_container
- Loading branch information
131 parents
1ddadb6
+
2a36660
+
b606864
+
41467b4
+
b11a11a
+
de9f81e
+
5737317
+
c7cdc55
+
a50e2ae
+
80fc529
+
ba58ad8
+
a20b034
+
f3031d6
+
f095b61
+
ee7be4f
+
5cd5b6f
+
560bbb2
+
211c08a
+
164a230
+
1fa8900
+
2b3577e
+
495bb6c
+
ab5c324
+
2e456c8
+
63bff97
+
f7e139b
+
3cb454e
+
22f9181
+
93a693f
+
2a458de
+
1c142d8
+
7f95140
+
be3c33f
+
7ab0a73
+
8cb2a33
+
56ac953
+
4157e43
+
0ec8c93
+
4bea232
+
26b2403
+
11d87a1
+
fb85298
+
6bda27e
+
b73658e
+
1020b71
+
58956c7
+
4de672f
+
79fe77b
+
7624c04
+
cfbc839
+
49e4d7c
+
ff81391
+
21cca29
+
f0671be
+
7c4ff71
+
98d530a
+
8d88cc5
+
390535a
+
00e3a5a
+
1debe09
+
90714d6
+
b60de46
+
239a3c3
+
623bc45
+
caef534
+
2df5656
+
43268cd
+
a75eec7
+
2567e8f
+
ea9335d
+
464392f
+
7fd0ba3
+
1e64d87
+
c8ba509
+
ca73950
+
c8dc1c3
+
bb4f382
+
c7e8658
+
7182b57
+
7681cd3
+
9e9880e
+
e68c740
+
a5f5145
+
e24bcf7
+
0cf2624
+
74f8e99
+
9dc42d7
+
6918467
+
75ec452
+
7032642
+
79c38ce
+
995e0a7
+
bb2d896
+
1b246ad
+
b74beb0
+
d10206d
+
242a79a
+
8a250b9
+
537a949
+
9269d97
+
2698f19
+
4cf6c67
+
5866634
+
6ef9027
+
af148c0
+
e8a3d3b
+
769eee2
+
db12820
+
0b7828e
+
1da1921
+
9643cb4
+
c09dfeb
+
831c808
+
346e46a
+
09df463
+
a6b3a5c
+
81271a1
+
a27453a
+
64fe065
+
042e1cd
+
abd6687
+
0dcab85
+
b47ae92
+
630648b
+
3a97e95
+
1a3b527
+
53e423c
+
854a12d
+
accad73
+
4a1dcdf
+
829f99f
commit c825927
Showing
16 changed files
with
1,190 additions
and
560 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
namespace Zend\Dom; | ||
|
||
use ErrorException; | ||
|
||
/** | ||
* Extends DOMXpath to throw ErrorExceptions instead of raising errors. | ||
*/ | ||
class DOMXPath extends \DOMXPath | ||
{ | ||
/** | ||
* A stack of ErrorExceptions created via addError() | ||
* | ||
* @var array | ||
*/ | ||
protected $errors = array(null); | ||
|
||
/** | ||
* Evaluates an XPath expression; throws an ErrorException instead of | ||
* raising an error | ||
* | ||
* @param string $expression The XPath expression to evaluate. | ||
* @return \DOMNodeList | ||
* @throws ErrorException | ||
*/ | ||
public function queryWithErrorException($expression) | ||
{ | ||
$this->errors = array(null); | ||
|
||
set_error_handler(array($this, 'addError'), \E_WARNING); | ||
$nodeList = $this->query($expression); | ||
restore_error_handler(); | ||
|
||
$exception = array_pop($this->errors); | ||
if ($exception) { | ||
throw $exception; | ||
} | ||
|
||
return $nodeList; | ||
} | ||
|
||
/** | ||
* Adds an error to the stack of errors | ||
* | ||
* @param int $errno | ||
* @param string $errstr | ||
* @param string $errfile | ||
* @param int $errline | ||
* @return void | ||
*/ | ||
public function addError($errno, $errstr = '', $errfile = '', $errline = 0) | ||
{ | ||
$last_error = end($this->errors); | ||
$this->errors[] = new ErrorException( | ||
$errstr, | ||
0, | ||
$errno, | ||
$errfile, | ||
$errline, | ||
$last_error | ||
); | ||
} | ||
} |
Oops, something went wrong.