@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | */ |
16 | 16 | function lzf_compress(string $data): string |
17 | 17 | { |
18 | - error_clear_last(); |
|
19 | - $result = \lzf_compress($data); |
|
20 | - if ($result === false) { |
|
21 | - throw LzfException::createFromPhpError(); |
|
22 | - } |
|
23 | - return $result; |
|
18 | + error_clear_last(); |
|
19 | + $result = \lzf_compress($data); |
|
20 | + if ($result === false) { |
|
21 | + throw LzfException::createFromPhpError(); |
|
22 | + } |
|
23 | + return $result; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function lzf_decompress(string $data): string |
37 | 37 | { |
38 | - error_clear_last(); |
|
39 | - $result = \lzf_decompress($data); |
|
40 | - if ($result === false) { |
|
41 | - throw LzfException::createFromPhpError(); |
|
42 | - } |
|
43 | - return $result; |
|
38 | + error_clear_last(); |
|
39 | + $result = \lzf_decompress($data); |
|
40 | + if ($result === false) { |
|
41 | + throw LzfException::createFromPhpError(); |
|
42 | + } |
|
43 | + return $result; |
|
44 | 44 | } |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | */ |
31 | 31 | function define(string $name, $value, bool $case_insensitive = false): void |
32 | 32 | { |
33 | - error_clear_last(); |
|
34 | - $result = \define($name, $value, $case_insensitive); |
|
35 | - if ($result === false) { |
|
36 | - throw MiscException::createFromPhpError(); |
|
37 | - } |
|
33 | + error_clear_last(); |
|
34 | + $result = \define($name, $value, $case_insensitive); |
|
35 | + if ($result === false) { |
|
36 | + throw MiscException::createFromPhpError(); |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | */ |
61 | 61 | function highlight_file(string $filename, bool $return = false) |
62 | 62 | { |
63 | - error_clear_last(); |
|
64 | - $result = \highlight_file($filename, $return); |
|
65 | - if ($result === false) { |
|
66 | - throw MiscException::createFromPhpError(); |
|
67 | - } |
|
68 | - return $result; |
|
63 | + error_clear_last(); |
|
64 | + $result = \highlight_file($filename, $return); |
|
65 | + if ($result === false) { |
|
66 | + throw MiscException::createFromPhpError(); |
|
67 | + } |
|
68 | + return $result; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -83,12 +83,12 @@ discard block |
||
83 | 83 | */ |
84 | 84 | function highlight_string(string $str, bool $return = false) |
85 | 85 | { |
86 | - error_clear_last(); |
|
87 | - $result = \highlight_string($str, $return); |
|
88 | - if ($result === false) { |
|
89 | - throw MiscException::createFromPhpError(); |
|
90 | - } |
|
91 | - return $result; |
|
86 | + error_clear_last(); |
|
87 | + $result = \highlight_string($str, $return); |
|
88 | + if ($result === false) { |
|
89 | + throw MiscException::createFromPhpError(); |
|
90 | + } |
|
91 | + return $result; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -248,16 +248,16 @@ discard block |
||
248 | 248 | */ |
249 | 249 | function pack(string $format, ...$params): string |
250 | 250 | { |
251 | - error_clear_last(); |
|
252 | - if ($params !== []) { |
|
253 | - $result = \pack($format, ...$params); |
|
254 | - } else { |
|
255 | - $result = \pack($format); |
|
256 | - } |
|
257 | - if ($result === false) { |
|
258 | - throw MiscException::createFromPhpError(); |
|
259 | - } |
|
260 | - return $result; |
|
251 | + error_clear_last(); |
|
252 | + if ($params !== []) { |
|
253 | + $result = \pack($format, ...$params); |
|
254 | + } else { |
|
255 | + $result = \pack($format); |
|
256 | + } |
|
257 | + if ($result === false) { |
|
258 | + throw MiscException::createFromPhpError(); |
|
259 | + } |
|
260 | + return $result; |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | */ |
277 | 277 | function sapi_windows_cp_conv($in_codepage, $out_codepage, string $subject): string |
278 | 278 | { |
279 | - error_clear_last(); |
|
280 | - $result = \sapi_windows_cp_conv($in_codepage, $out_codepage, $subject); |
|
281 | - if ($result === null) { |
|
282 | - throw MiscException::createFromPhpError(); |
|
283 | - } |
|
284 | - return $result; |
|
279 | + error_clear_last(); |
|
280 | + $result = \sapi_windows_cp_conv($in_codepage, $out_codepage, $subject); |
|
281 | + if ($result === null) { |
|
282 | + throw MiscException::createFromPhpError(); |
|
283 | + } |
|
284 | + return $result; |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | |
@@ -294,11 +294,11 @@ discard block |
||
294 | 294 | */ |
295 | 295 | function sapi_windows_cp_set(int $cp): void |
296 | 296 | { |
297 | - error_clear_last(); |
|
298 | - $result = \sapi_windows_cp_set($cp); |
|
299 | - if ($result === false) { |
|
300 | - throw MiscException::createFromPhpError(); |
|
301 | - } |
|
297 | + error_clear_last(); |
|
298 | + $result = \sapi_windows_cp_set($cp); |
|
299 | + if ($result === false) { |
|
300 | + throw MiscException::createFromPhpError(); |
|
301 | + } |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
@@ -315,11 +315,11 @@ discard block |
||
315 | 315 | */ |
316 | 316 | function sapi_windows_generate_ctrl_event(int $event, int $pid = 0): void |
317 | 317 | { |
318 | - error_clear_last(); |
|
319 | - $result = \sapi_windows_generate_ctrl_event($event, $pid); |
|
320 | - if ($result === false) { |
|
321 | - throw MiscException::createFromPhpError(); |
|
322 | - } |
|
318 | + error_clear_last(); |
|
319 | + $result = \sapi_windows_generate_ctrl_event($event, $pid); |
|
320 | + if ($result === false) { |
|
321 | + throw MiscException::createFromPhpError(); |
|
322 | + } |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -341,15 +341,15 @@ discard block |
||
341 | 341 | */ |
342 | 342 | function sapi_windows_vt100_support($stream, bool $enable = null): void |
343 | 343 | { |
344 | - error_clear_last(); |
|
345 | - if ($enable !== null) { |
|
346 | - $result = \sapi_windows_vt100_support($stream, $enable); |
|
347 | - } else { |
|
348 | - $result = \sapi_windows_vt100_support($stream); |
|
349 | - } |
|
350 | - if ($result === false) { |
|
351 | - throw MiscException::createFromPhpError(); |
|
352 | - } |
|
344 | + error_clear_last(); |
|
345 | + if ($enable !== null) { |
|
346 | + $result = \sapi_windows_vt100_support($stream, $enable); |
|
347 | + } else { |
|
348 | + $result = \sapi_windows_vt100_support($stream); |
|
349 | + } |
|
350 | + if ($result === false) { |
|
351 | + throw MiscException::createFromPhpError(); |
|
352 | + } |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | |
@@ -370,12 +370,12 @@ discard block |
||
370 | 370 | */ |
371 | 371 | function sleep(int $seconds): int |
372 | 372 | { |
373 | - error_clear_last(); |
|
374 | - $result = \sleep($seconds); |
|
375 | - if ($result === false) { |
|
376 | - throw MiscException::createFromPhpError(); |
|
377 | - } |
|
378 | - return $result; |
|
373 | + error_clear_last(); |
|
374 | + $result = \sleep($seconds); |
|
375 | + if ($result === false) { |
|
376 | + throw MiscException::createFromPhpError(); |
|
377 | + } |
|
378 | + return $result; |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | |
@@ -408,12 +408,12 @@ discard block |
||
408 | 408 | */ |
409 | 409 | function time_nanosleep(int $seconds, int $nanoseconds) |
410 | 410 | { |
411 | - error_clear_last(); |
|
412 | - $result = \time_nanosleep($seconds, $nanoseconds); |
|
413 | - if ($result === false) { |
|
414 | - throw MiscException::createFromPhpError(); |
|
415 | - } |
|
416 | - return $result; |
|
411 | + error_clear_last(); |
|
412 | + $result = \time_nanosleep($seconds, $nanoseconds); |
|
413 | + if ($result === false) { |
|
414 | + throw MiscException::createFromPhpError(); |
|
415 | + } |
|
416 | + return $result; |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | |
@@ -427,11 +427,11 @@ discard block |
||
427 | 427 | */ |
428 | 428 | function time_sleep_until(float $timestamp): void |
429 | 429 | { |
430 | - error_clear_last(); |
|
431 | - $result = \time_sleep_until($timestamp); |
|
432 | - if ($result === false) { |
|
433 | - throw MiscException::createFromPhpError(); |
|
434 | - } |
|
430 | + error_clear_last(); |
|
431 | + $result = \time_sleep_until($timestamp); |
|
432 | + if ($result === false) { |
|
433 | + throw MiscException::createFromPhpError(); |
|
434 | + } |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | |
@@ -455,10 +455,10 @@ discard block |
||
455 | 455 | */ |
456 | 456 | function unpack(string $format, string $data, int $offset = 0): array |
457 | 457 | { |
458 | - error_clear_last(); |
|
459 | - $result = \unpack($format, $data, $offset); |
|
460 | - if ($result === false) { |
|
461 | - throw MiscException::createFromPhpError(); |
|
462 | - } |
|
463 | - return $result; |
|
458 | + error_clear_last(); |
|
459 | + $result = \unpack($format, $data, $offset); |
|
460 | + if ($result === false) { |
|
461 | + throw MiscException::createFromPhpError(); |
|
462 | + } |
|
463 | + return $result; |
|
464 | 464 | } |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function yaz_ccl_parse($id, string $query, ?array &$result): void |
51 | 51 | { |
52 | - error_clear_last(); |
|
53 | - $result = \yaz_ccl_parse($id, $query, $result); |
|
54 | - if ($result === false) { |
|
55 | - throw YazException::createFromPhpError(); |
|
56 | - } |
|
52 | + error_clear_last(); |
|
53 | + $result = \yaz_ccl_parse($id, $query, $result); |
|
54 | + if ($result === false) { |
|
55 | + throw YazException::createFromPhpError(); |
|
56 | + } |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | */ |
67 | 67 | function yaz_close($id): void |
68 | 68 | { |
69 | - error_clear_last(); |
|
70 | - $result = \yaz_close($id); |
|
71 | - if ($result === false) { |
|
72 | - throw YazException::createFromPhpError(); |
|
73 | - } |
|
69 | + error_clear_last(); |
|
70 | + $result = \yaz_close($id); |
|
71 | + if ($result === false) { |
|
72 | + throw YazException::createFromPhpError(); |
|
73 | + } |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -267,16 +267,16 @@ discard block |
||
267 | 267 | */ |
268 | 268 | function yaz_connect(string $zurl, $options = null) |
269 | 269 | { |
270 | - error_clear_last(); |
|
271 | - if ($options !== null) { |
|
272 | - $result = \yaz_connect($zurl, $options); |
|
273 | - } else { |
|
274 | - $result = \yaz_connect($zurl); |
|
275 | - } |
|
276 | - if ($result === false) { |
|
277 | - throw YazException::createFromPhpError(); |
|
278 | - } |
|
279 | - return $result; |
|
270 | + error_clear_last(); |
|
271 | + if ($options !== null) { |
|
272 | + $result = \yaz_connect($zurl, $options); |
|
273 | + } else { |
|
274 | + $result = \yaz_connect($zurl); |
|
275 | + } |
|
276 | + if ($result === false) { |
|
277 | + throw YazException::createFromPhpError(); |
|
278 | + } |
|
279 | + return $result; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -294,11 +294,11 @@ discard block |
||
294 | 294 | */ |
295 | 295 | function yaz_database($id, string $databases): void |
296 | 296 | { |
297 | - error_clear_last(); |
|
298 | - $result = \yaz_database($id, $databases); |
|
299 | - if ($result === false) { |
|
300 | - throw YazException::createFromPhpError(); |
|
301 | - } |
|
297 | + error_clear_last(); |
|
298 | + $result = \yaz_database($id, $databases); |
|
299 | + if ($result === false) { |
|
300 | + throw YazException::createFromPhpError(); |
|
301 | + } |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
@@ -317,11 +317,11 @@ discard block |
||
317 | 317 | */ |
318 | 318 | function yaz_element($id, string $elementset): void |
319 | 319 | { |
320 | - error_clear_last(); |
|
321 | - $result = \yaz_element($id, $elementset); |
|
322 | - if ($result === false) { |
|
323 | - throw YazException::createFromPhpError(); |
|
324 | - } |
|
320 | + error_clear_last(); |
|
321 | + $result = \yaz_element($id, $elementset); |
|
322 | + if ($result === false) { |
|
323 | + throw YazException::createFromPhpError(); |
|
324 | + } |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | */ |
338 | 338 | function yaz_present($id): void |
339 | 339 | { |
340 | - error_clear_last(); |
|
341 | - $result = \yaz_present($id); |
|
342 | - if ($result === false) { |
|
343 | - throw YazException::createFromPhpError(); |
|
344 | - } |
|
340 | + error_clear_last(); |
|
341 | + $result = \yaz_present($id); |
|
342 | + if ($result === false) { |
|
343 | + throw YazException::createFromPhpError(); |
|
344 | + } |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | */ |
378 | 378 | function yaz_search($id, string $type, string $query): void |
379 | 379 | { |
380 | - error_clear_last(); |
|
381 | - $result = \yaz_search($id, $type, $query); |
|
382 | - if ($result === false) { |
|
383 | - throw YazException::createFromPhpError(); |
|
384 | - } |
|
380 | + error_clear_last(); |
|
381 | + $result = \yaz_search($id, $type, $query); |
|
382 | + if ($result === false) { |
|
383 | + throw YazException::createFromPhpError(); |
|
384 | + } |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | |
@@ -429,10 +429,10 @@ discard block |
||
429 | 429 | */ |
430 | 430 | function yaz_wait(array &$options = null) |
431 | 431 | { |
432 | - error_clear_last(); |
|
433 | - $result = \yaz_wait($options); |
|
434 | - if ($result === false) { |
|
435 | - throw YazException::createFromPhpError(); |
|
436 | - } |
|
437 | - return $result; |
|
432 | + error_clear_last(); |
|
433 | + $result = \yaz_wait($options); |
|
434 | + if ($result === false) { |
|
435 | + throw YazException::createFromPhpError(); |
|
436 | + } |
|
437 | + return $result; |
|
438 | 438 | } |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | */ |
37 | 37 | function socket_accept($socket) |
38 | 38 | { |
39 | - error_clear_last(); |
|
40 | - $result = \socket_accept($socket); |
|
41 | - if ($result === false) { |
|
42 | - throw SocketsException::createFromPhpError(); |
|
43 | - } |
|
44 | - return $result; |
|
39 | + error_clear_last(); |
|
40 | + $result = \socket_accept($socket); |
|
41 | + if ($result === false) { |
|
42 | + throw SocketsException::createFromPhpError(); |
|
43 | + } |
|
44 | + return $result; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | */ |
57 | 57 | function socket_addrinfo_bind($addr) |
58 | 58 | { |
59 | - error_clear_last(); |
|
60 | - $result = \socket_addrinfo_bind($addr); |
|
61 | - if ($result === null) { |
|
62 | - throw SocketsException::createFromPhpError(); |
|
63 | - } |
|
64 | - return $result; |
|
59 | + error_clear_last(); |
|
60 | + $result = \socket_addrinfo_bind($addr); |
|
61 | + if ($result === null) { |
|
62 | + throw SocketsException::createFromPhpError(); |
|
63 | + } |
|
64 | + return $result; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | */ |
77 | 77 | function socket_addrinfo_connect($addr) |
78 | 78 | { |
79 | - error_clear_last(); |
|
80 | - $result = \socket_addrinfo_connect($addr); |
|
81 | - if ($result === null) { |
|
82 | - throw SocketsException::createFromPhpError(); |
|
83 | - } |
|
84 | - return $result; |
|
79 | + error_clear_last(); |
|
80 | + $result = \socket_addrinfo_connect($addr); |
|
81 | + if ($result === null) { |
|
82 | + throw SocketsException::createFromPhpError(); |
|
83 | + } |
|
84 | + return $result; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | */ |
108 | 108 | function socket_bind($socket, string $address, int $port = 0): void |
109 | 109 | { |
110 | - error_clear_last(); |
|
111 | - $result = \socket_bind($socket, $address, $port); |
|
112 | - if ($result === false) { |
|
113 | - throw SocketsException::createFromPhpError(); |
|
114 | - } |
|
110 | + error_clear_last(); |
|
111 | + $result = \socket_bind($socket, $address, $port); |
|
112 | + if ($result === false) { |
|
113 | + throw SocketsException::createFromPhpError(); |
|
114 | + } |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | */ |
138 | 138 | function socket_connect($socket, string $address, int $port = 0): void |
139 | 139 | { |
140 | - error_clear_last(); |
|
141 | - $result = \socket_connect($socket, $address, $port); |
|
142 | - if ($result === false) { |
|
143 | - throw SocketsException::createFromPhpError(); |
|
144 | - } |
|
140 | + error_clear_last(); |
|
141 | + $result = \socket_connect($socket, $address, $port); |
|
142 | + if ($result === false) { |
|
143 | + throw SocketsException::createFromPhpError(); |
|
144 | + } |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | */ |
170 | 170 | function socket_create_listen(int $port, int $backlog = 128) |
171 | 171 | { |
172 | - error_clear_last(); |
|
173 | - $result = \socket_create_listen($port, $backlog); |
|
174 | - if ($result === false) { |
|
175 | - throw SocketsException::createFromPhpError(); |
|
176 | - } |
|
177 | - return $result; |
|
172 | + error_clear_last(); |
|
173 | + $result = \socket_create_listen($port, $backlog); |
|
174 | + if ($result === false) { |
|
175 | + throw SocketsException::createFromPhpError(); |
|
176 | + } |
|
177 | + return $result; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | */ |
206 | 206 | function socket_create_pair(int $domain, int $type, int $protocol, ?iterable &$fd): void |
207 | 207 | { |
208 | - error_clear_last(); |
|
209 | - $result = \socket_create_pair($domain, $type, $protocol, $fd); |
|
210 | - if ($result === false) { |
|
211 | - throw SocketsException::createFromPhpError(); |
|
212 | - } |
|
208 | + error_clear_last(); |
|
209 | + $result = \socket_create_pair($domain, $type, $protocol, $fd); |
|
210 | + if ($result === false) { |
|
211 | + throw SocketsException::createFromPhpError(); |
|
212 | + } |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -238,12 +238,12 @@ discard block |
||
238 | 238 | */ |
239 | 239 | function socket_create(int $domain, int $type, int $protocol) |
240 | 240 | { |
241 | - error_clear_last(); |
|
242 | - $result = \socket_create($domain, $type, $protocol); |
|
243 | - if ($result === false) { |
|
244 | - throw SocketsException::createFromPhpError(); |
|
245 | - } |
|
246 | - return $result; |
|
241 | + error_clear_last(); |
|
242 | + $result = \socket_create($domain, $type, $protocol); |
|
243 | + if ($result === false) { |
|
244 | + throw SocketsException::createFromPhpError(); |
|
245 | + } |
|
246 | + return $result; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | |
@@ -257,12 +257,12 @@ discard block |
||
257 | 257 | */ |
258 | 258 | function socket_export_stream($socket) |
259 | 259 | { |
260 | - error_clear_last(); |
|
261 | - $result = \socket_export_stream($socket); |
|
262 | - if ($result === false) { |
|
263 | - throw SocketsException::createFromPhpError(); |
|
264 | - } |
|
265 | - return $result; |
|
260 | + error_clear_last(); |
|
261 | + $result = \socket_export_stream($socket); |
|
262 | + if ($result === false) { |
|
263 | + throw SocketsException::createFromPhpError(); |
|
264 | + } |
|
265 | + return $result; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -304,12 +304,12 @@ discard block |
||
304 | 304 | */ |
305 | 305 | function socket_get_option($socket, int $level, int $optname) |
306 | 306 | { |
307 | - error_clear_last(); |
|
308 | - $result = \socket_get_option($socket, $level, $optname); |
|
309 | - if ($result === false) { |
|
310 | - throw SocketsException::createFromPhpError(); |
|
311 | - } |
|
312 | - return $result; |
|
307 | + error_clear_last(); |
|
308 | + $result = \socket_get_option($socket, $level, $optname); |
|
309 | + if ($result === false) { |
|
310 | + throw SocketsException::createFromPhpError(); |
|
311 | + } |
|
312 | + return $result; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | |
@@ -338,11 +338,11 @@ discard block |
||
338 | 338 | */ |
339 | 339 | function socket_getpeername($socket, string &$address, ?int &$port = null): void |
340 | 340 | { |
341 | - error_clear_last(); |
|
342 | - $result = \socket_getpeername($socket, $address, $port); |
|
343 | - if ($result === false) { |
|
344 | - throw SocketsException::createFromPhpError(); |
|
345 | - } |
|
341 | + error_clear_last(); |
|
342 | + $result = \socket_getpeername($socket, $address, $port); |
|
343 | + if ($result === false) { |
|
344 | + throw SocketsException::createFromPhpError(); |
|
345 | + } |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | |
@@ -368,11 +368,11 @@ discard block |
||
368 | 368 | */ |
369 | 369 | function socket_getsockname($socket, ?string &$addr, ?int &$port = null): void |
370 | 370 | { |
371 | - error_clear_last(); |
|
372 | - $result = \socket_getsockname($socket, $addr, $port); |
|
373 | - if ($result === false) { |
|
374 | - throw SocketsException::createFromPhpError(); |
|
375 | - } |
|
371 | + error_clear_last(); |
|
372 | + $result = \socket_getsockname($socket, $addr, $port); |
|
373 | + if ($result === false) { |
|
374 | + throw SocketsException::createFromPhpError(); |
|
375 | + } |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -386,12 +386,12 @@ discard block |
||
386 | 386 | */ |
387 | 387 | function socket_import_stream($stream) |
388 | 388 | { |
389 | - error_clear_last(); |
|
390 | - $result = \socket_import_stream($stream); |
|
391 | - if ($result === null) { |
|
392 | - throw SocketsException::createFromPhpError(); |
|
393 | - } |
|
394 | - return $result; |
|
389 | + error_clear_last(); |
|
390 | + $result = \socket_import_stream($stream); |
|
391 | + if ($result === null) { |
|
392 | + throw SocketsException::createFromPhpError(); |
|
393 | + } |
|
394 | + return $result; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -425,11 +425,11 @@ discard block |
||
425 | 425 | */ |
426 | 426 | function socket_listen($socket, int $backlog = 0): void |
427 | 427 | { |
428 | - error_clear_last(); |
|
429 | - $result = \socket_listen($socket, $backlog); |
|
430 | - if ($result === false) { |
|
431 | - throw SocketsException::createFromPhpError(); |
|
432 | - } |
|
428 | + error_clear_last(); |
|
429 | + $result = \socket_listen($socket, $backlog); |
|
430 | + if ($result === false) { |
|
431 | + throw SocketsException::createFromPhpError(); |
|
432 | + } |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -471,12 +471,12 @@ discard block |
||
471 | 471 | */ |
472 | 472 | function socket_read($socket, int $length, int $type = PHP_BINARY_READ): string |
473 | 473 | { |
474 | - error_clear_last(); |
|
475 | - $result = \socket_read($socket, $length, $type); |
|
476 | - if ($result === false) { |
|
477 | - throw SocketsException::createFromPhpError(); |
|
478 | - } |
|
479 | - return $result; |
|
474 | + error_clear_last(); |
|
475 | + $result = \socket_read($socket, $length, $type); |
|
476 | + if ($result === false) { |
|
477 | + throw SocketsException::createFromPhpError(); |
|
478 | + } |
|
479 | + return $result; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | |
@@ -532,12 +532,12 @@ discard block |
||
532 | 532 | */ |
533 | 533 | function socket_send($socket, string $buf, int $len, int $flags): int |
534 | 534 | { |
535 | - error_clear_last(); |
|
536 | - $result = \socket_send($socket, $buf, $len, $flags); |
|
537 | - if ($result === false) { |
|
538 | - throw SocketsException::createFromPhpError(); |
|
539 | - } |
|
540 | - return $result; |
|
535 | + error_clear_last(); |
|
536 | + $result = \socket_send($socket, $buf, $len, $flags); |
|
537 | + if ($result === false) { |
|
538 | + throw SocketsException::createFromPhpError(); |
|
539 | + } |
|
540 | + return $result; |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | |
@@ -553,12 +553,12 @@ discard block |
||
553 | 553 | */ |
554 | 554 | function socket_sendmsg($socket, array $message, int $flags = 0): int |
555 | 555 | { |
556 | - error_clear_last(); |
|
557 | - $result = \socket_sendmsg($socket, $message, $flags); |
|
558 | - if ($result === false) { |
|
559 | - throw SocketsException::createFromPhpError(); |
|
560 | - } |
|
561 | - return $result; |
|
556 | + error_clear_last(); |
|
557 | + $result = \socket_sendmsg($socket, $message, $flags); |
|
558 | + if ($result === false) { |
|
559 | + throw SocketsException::createFromPhpError(); |
|
560 | + } |
|
561 | + return $result; |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | |
@@ -618,12 +618,12 @@ discard block |
||
618 | 618 | */ |
619 | 619 | function socket_sendto($socket, string $buf, int $len, int $flags, string $addr, int $port = 0): int |
620 | 620 | { |
621 | - error_clear_last(); |
|
622 | - $result = \socket_sendto($socket, $buf, $len, $flags, $addr, $port); |
|
623 | - if ($result === false) { |
|
624 | - throw SocketsException::createFromPhpError(); |
|
625 | - } |
|
626 | - return $result; |
|
621 | + error_clear_last(); |
|
622 | + $result = \socket_sendto($socket, $buf, $len, $flags, $addr, $port); |
|
623 | + if ($result === false) { |
|
624 | + throw SocketsException::createFromPhpError(); |
|
625 | + } |
|
626 | + return $result; |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | |
@@ -643,11 +643,11 @@ discard block |
||
643 | 643 | */ |
644 | 644 | function socket_set_block($socket): void |
645 | 645 | { |
646 | - error_clear_last(); |
|
647 | - $result = \socket_set_block($socket); |
|
648 | - if ($result === false) { |
|
649 | - throw SocketsException::createFromPhpError(); |
|
650 | - } |
|
646 | + error_clear_last(); |
|
647 | + $result = \socket_set_block($socket); |
|
648 | + if ($result === false) { |
|
649 | + throw SocketsException::createFromPhpError(); |
|
650 | + } |
|
651 | 651 | } |
652 | 652 | |
653 | 653 | |
@@ -668,11 +668,11 @@ discard block |
||
668 | 668 | */ |
669 | 669 | function socket_set_nonblock($socket): void |
670 | 670 | { |
671 | - error_clear_last(); |
|
672 | - $result = \socket_set_nonblock($socket); |
|
673 | - if ($result === false) { |
|
674 | - throw SocketsException::createFromPhpError(); |
|
675 | - } |
|
671 | + error_clear_last(); |
|
672 | + $result = \socket_set_nonblock($socket); |
|
673 | + if ($result === false) { |
|
674 | + throw SocketsException::createFromPhpError(); |
|
675 | + } |
|
676 | 676 | } |
677 | 677 | |
678 | 678 | |
@@ -700,11 +700,11 @@ discard block |
||
700 | 700 | */ |
701 | 701 | function socket_set_option($socket, int $level, int $optname, $optval): void |
702 | 702 | { |
703 | - error_clear_last(); |
|
704 | - $result = \socket_set_option($socket, $level, $optname, $optval); |
|
705 | - if ($result === false) { |
|
706 | - throw SocketsException::createFromPhpError(); |
|
707 | - } |
|
703 | + error_clear_last(); |
|
704 | + $result = \socket_set_option($socket, $level, $optname, $optval); |
|
705 | + if ($result === false) { |
|
706 | + throw SocketsException::createFromPhpError(); |
|
707 | + } |
|
708 | 708 | } |
709 | 709 | |
710 | 710 | |
@@ -745,11 +745,11 @@ discard block |
||
745 | 745 | */ |
746 | 746 | function socket_shutdown($socket, int $how = 2): void |
747 | 747 | { |
748 | - error_clear_last(); |
|
749 | - $result = \socket_shutdown($socket, $how); |
|
750 | - if ($result === false) { |
|
751 | - throw SocketsException::createFromPhpError(); |
|
752 | - } |
|
748 | + error_clear_last(); |
|
749 | + $result = \socket_shutdown($socket, $how); |
|
750 | + if ($result === false) { |
|
751 | + throw SocketsException::createFromPhpError(); |
|
752 | + } |
|
753 | 753 | } |
754 | 754 | |
755 | 755 | |
@@ -766,12 +766,12 @@ discard block |
||
766 | 766 | */ |
767 | 767 | function socket_wsaprotocol_info_export($socket, int $target_pid): string |
768 | 768 | { |
769 | - error_clear_last(); |
|
770 | - $result = \socket_wsaprotocol_info_export($socket, $target_pid); |
|
771 | - if ($result === false) { |
|
772 | - throw SocketsException::createFromPhpError(); |
|
773 | - } |
|
774 | - return $result; |
|
769 | + error_clear_last(); |
|
770 | + $result = \socket_wsaprotocol_info_export($socket, $target_pid); |
|
771 | + if ($result === false) { |
|
772 | + throw SocketsException::createFromPhpError(); |
|
773 | + } |
|
774 | + return $result; |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | |
@@ -786,12 +786,12 @@ discard block |
||
786 | 786 | */ |
787 | 787 | function socket_wsaprotocol_info_import(string $info_id) |
788 | 788 | { |
789 | - error_clear_last(); |
|
790 | - $result = \socket_wsaprotocol_info_import($info_id); |
|
791 | - if ($result === false) { |
|
792 | - throw SocketsException::createFromPhpError(); |
|
793 | - } |
|
794 | - return $result; |
|
789 | + error_clear_last(); |
|
790 | + $result = \socket_wsaprotocol_info_import($info_id); |
|
791 | + if ($result === false) { |
|
792 | + throw SocketsException::createFromPhpError(); |
|
793 | + } |
|
794 | + return $result; |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | |
@@ -805,9 +805,9 @@ discard block |
||
805 | 805 | */ |
806 | 806 | function socket_wsaprotocol_info_release(string $info_id): void |
807 | 807 | { |
808 | - error_clear_last(); |
|
809 | - $result = \socket_wsaprotocol_info_release($info_id); |
|
810 | - if ($result === false) { |
|
811 | - throw SocketsException::createFromPhpError(); |
|
812 | - } |
|
808 | + error_clear_last(); |
|
809 | + $result = \socket_wsaprotocol_info_release($info_id); |
|
810 | + if ($result === false) { |
|
811 | + throw SocketsException::createFromPhpError(); |
|
812 | + } |
|
813 | 813 | } |
@@ -24,18 +24,18 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function xml_parser_create_ns(string $encoding = null, string $separator = ":") |
26 | 26 | { |
27 | - error_clear_last(); |
|
28 | - if ($separator !== ":") { |
|
29 | - $result = \xml_parser_create_ns($encoding, $separator); |
|
30 | - } elseif ($encoding !== null) { |
|
31 | - $result = \xml_parser_create_ns($encoding); |
|
32 | - } else { |
|
33 | - $result = \xml_parser_create_ns(); |
|
34 | - } |
|
35 | - if ($result === false) { |
|
36 | - throw XmlException::createFromPhpError(); |
|
37 | - } |
|
38 | - return $result; |
|
27 | + error_clear_last(); |
|
28 | + if ($separator !== ":") { |
|
29 | + $result = \xml_parser_create_ns($encoding, $separator); |
|
30 | + } elseif ($encoding !== null) { |
|
31 | + $result = \xml_parser_create_ns($encoding); |
|
32 | + } else { |
|
33 | + $result = \xml_parser_create_ns(); |
|
34 | + } |
|
35 | + if ($result === false) { |
|
36 | + throw XmlException::createFromPhpError(); |
|
37 | + } |
|
38 | + return $result; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -61,16 +61,16 @@ discard block |
||
61 | 61 | */ |
62 | 62 | function xml_parser_create(string $encoding = null) |
63 | 63 | { |
64 | - error_clear_last(); |
|
65 | - if ($encoding !== null) { |
|
66 | - $result = \xml_parser_create($encoding); |
|
67 | - } else { |
|
68 | - $result = \xml_parser_create(); |
|
69 | - } |
|
70 | - if ($result === false) { |
|
71 | - throw XmlException::createFromPhpError(); |
|
72 | - } |
|
73 | - return $result; |
|
64 | + error_clear_last(); |
|
65 | + if ($encoding !== null) { |
|
66 | + $result = \xml_parser_create($encoding); |
|
67 | + } else { |
|
68 | + $result = \xml_parser_create(); |
|
69 | + } |
|
70 | + if ($result === false) { |
|
71 | + throw XmlException::createFromPhpError(); |
|
72 | + } |
|
73 | + return $result; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | */ |
88 | 88 | function xml_set_object($parser, object &$object): void |
89 | 89 | { |
90 | - error_clear_last(); |
|
91 | - $result = \xml_set_object($parser, $object); |
|
92 | - if ($result === false) { |
|
93 | - throw XmlException::createFromPhpError(); |
|
94 | - } |
|
90 | + error_clear_last(); |
|
91 | + $result = \xml_set_object($parser, $object); |
|
92 | + if ($result === false) { |
|
93 | + throw XmlException::createFromPhpError(); |
|
94 | + } |
|
95 | 95 | } |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | */ |
29 | 29 | function com_event_sink(object $comobject, object $sinkobject, $sinkinterface = null): void |
30 | 30 | { |
31 | - error_clear_last(); |
|
32 | - if ($sinkinterface !== null) { |
|
33 | - $result = \com_event_sink($comobject, $sinkobject, $sinkinterface); |
|
34 | - } else { |
|
35 | - $result = \com_event_sink($comobject, $sinkobject); |
|
36 | - } |
|
37 | - if ($result === false) { |
|
38 | - throw ComException::createFromPhpError(); |
|
39 | - } |
|
31 | + error_clear_last(); |
|
32 | + if ($sinkinterface !== null) { |
|
33 | + $result = \com_event_sink($comobject, $sinkobject, $sinkinterface); |
|
34 | + } else { |
|
35 | + $result = \com_event_sink($comobject, $sinkobject); |
|
36 | + } |
|
37 | + if ($result === false) { |
|
38 | + throw ComException::createFromPhpError(); |
|
39 | + } |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | */ |
95 | 95 | function com_load_typelib(string $typelib_name, bool $case_sensitive = true): void |
96 | 96 | { |
97 | - error_clear_last(); |
|
98 | - $result = \com_load_typelib($typelib_name, $case_sensitive); |
|
99 | - if ($result === false) { |
|
100 | - throw ComException::createFromPhpError(); |
|
101 | - } |
|
97 | + error_clear_last(); |
|
98 | + $result = \com_load_typelib($typelib_name, $case_sensitive); |
|
99 | + if ($result === false) { |
|
100 | + throw ComException::createFromPhpError(); |
|
101 | + } |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | */ |
120 | 120 | function com_print_typeinfo(object $comobject, string $dispinterface = null, bool $wantsink = false): void |
121 | 121 | { |
122 | - error_clear_last(); |
|
123 | - $result = \com_print_typeinfo($comobject, $dispinterface, $wantsink); |
|
124 | - if ($result === false) { |
|
125 | - throw ComException::createFromPhpError(); |
|
126 | - } |
|
122 | + error_clear_last(); |
|
123 | + $result = \com_print_typeinfo($comobject, $dispinterface, $wantsink); |
|
124 | + if ($result === false) { |
|
125 | + throw ComException::createFromPhpError(); |
|
126 | + } |
|
127 | 127 | } |
@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | */ |
17 | 17 | function apcu_cache_info(bool $limited = false): array |
18 | 18 | { |
19 | - error_clear_last(); |
|
20 | - $result = \apcu_cache_info($limited); |
|
21 | - if ($result === false) { |
|
22 | - throw ApcuException::createFromPhpError(); |
|
23 | - } |
|
24 | - return $result; |
|
19 | + error_clear_last(); |
|
20 | + $result = \apcu_cache_info($limited); |
|
21 | + if ($result === false) { |
|
22 | + throw ApcuException::createFromPhpError(); |
|
23 | + } |
|
24 | + return $result; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function apcu_cas(string $key, int $old, int $new): void |
40 | 40 | { |
41 | - error_clear_last(); |
|
42 | - $result = \apcu_cas($key, $old, $new); |
|
43 | - if ($result === false) { |
|
44 | - throw ApcuException::createFromPhpError(); |
|
45 | - } |
|
41 | + error_clear_last(); |
|
42 | + $result = \apcu_cas($key, $old, $new); |
|
43 | + if ($result === false) { |
|
44 | + throw ApcuException::createFromPhpError(); |
|
45 | + } |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | */ |
61 | 61 | function apcu_dec(string $key, int $step = 1, ?bool &$success = null, int $ttl = 0): int |
62 | 62 | { |
63 | - error_clear_last(); |
|
64 | - $result = \apcu_dec($key, $step, $success, $ttl); |
|
65 | - if ($result === false) { |
|
66 | - throw ApcuException::createFromPhpError(); |
|
67 | - } |
|
68 | - return $result; |
|
63 | + error_clear_last(); |
|
64 | + $result = \apcu_dec($key, $step, $success, $ttl); |
|
65 | + if ($result === false) { |
|
66 | + throw ApcuException::createFromPhpError(); |
|
67 | + } |
|
68 | + return $result; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -83,12 +83,12 @@ discard block |
||
83 | 83 | */ |
84 | 84 | function apcu_inc(string $key, int $step = 1, ?bool &$success = null, int $ttl = 0): int |
85 | 85 | { |
86 | - error_clear_last(); |
|
87 | - $result = \apcu_inc($key, $step, $success, $ttl); |
|
88 | - if ($result === false) { |
|
89 | - throw ApcuException::createFromPhpError(); |
|
90 | - } |
|
91 | - return $result; |
|
86 | + error_clear_last(); |
|
87 | + $result = \apcu_inc($key, $step, $success, $ttl); |
|
88 | + if ($result === false) { |
|
89 | + throw ApcuException::createFromPhpError(); |
|
90 | + } |
|
91 | + return $result; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | */ |
104 | 104 | function apcu_sma_info(bool $limited = false): array |
105 | 105 | { |
106 | - error_clear_last(); |
|
107 | - $result = \apcu_sma_info($limited); |
|
108 | - if ($result === false) { |
|
109 | - throw ApcuException::createFromPhpError(); |
|
110 | - } |
|
111 | - return $result; |
|
106 | + error_clear_last(); |
|
107 | + $result = \apcu_sma_info($limited); |
|
108 | + if ($result === false) { |
|
109 | + throw ApcuException::createFromPhpError(); |
|
110 | + } |
|
111 | + return $result; |
|
112 | 112 | } |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | */ |
14 | 14 | function session_abort(): void |
15 | 15 | { |
16 | - error_clear_last(); |
|
17 | - $result = \session_abort(); |
|
18 | - if ($result === false) { |
|
19 | - throw SessionException::createFromPhpError(); |
|
20 | - } |
|
16 | + error_clear_last(); |
|
17 | + $result = \session_abort(); |
|
18 | + if ($result === false) { |
|
19 | + throw SessionException::createFromPhpError(); |
|
20 | + } |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function session_decode(string $data): void |
37 | 37 | { |
38 | - error_clear_last(); |
|
39 | - $result = \session_decode($data); |
|
40 | - if ($result === false) { |
|
41 | - throw SessionException::createFromPhpError(); |
|
42 | - } |
|
38 | + error_clear_last(); |
|
39 | + $result = \session_decode($data); |
|
40 | + if ($result === false) { |
|
41 | + throw SessionException::createFromPhpError(); |
|
42 | + } |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | */ |
62 | 62 | function session_destroy(): void |
63 | 63 | { |
64 | - error_clear_last(); |
|
65 | - $result = \session_destroy(); |
|
66 | - if ($result === false) { |
|
67 | - throw SessionException::createFromPhpError(); |
|
68 | - } |
|
64 | + error_clear_last(); |
|
65 | + $result = \session_destroy(); |
|
66 | + if ($result === false) { |
|
67 | + throw SessionException::createFromPhpError(); |
|
68 | + } |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | */ |
87 | 87 | function session_regenerate_id(bool $delete_old_session = false): void |
88 | 88 | { |
89 | - error_clear_last(); |
|
90 | - $result = \session_regenerate_id($delete_old_session); |
|
91 | - if ($result === false) { |
|
92 | - throw SessionException::createFromPhpError(); |
|
93 | - } |
|
89 | + error_clear_last(); |
|
90 | + $result = \session_regenerate_id($delete_old_session); |
|
91 | + if ($result === false) { |
|
92 | + throw SessionException::createFromPhpError(); |
|
93 | + } |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | */ |
105 | 105 | function session_reset(): void |
106 | 106 | { |
107 | - error_clear_last(); |
|
108 | - $result = \session_reset(); |
|
109 | - if ($result === false) { |
|
110 | - throw SessionException::createFromPhpError(); |
|
111 | - } |
|
107 | + error_clear_last(); |
|
108 | + $result = \session_reset(); |
|
109 | + if ($result === false) { |
|
110 | + throw SessionException::createFromPhpError(); |
|
111 | + } |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | */ |
122 | 122 | function session_unset(): void |
123 | 123 | { |
124 | - error_clear_last(); |
|
125 | - $result = \session_unset(); |
|
126 | - if ($result === false) { |
|
127 | - throw SessionException::createFromPhpError(); |
|
128 | - } |
|
124 | + error_clear_last(); |
|
125 | + $result = \session_unset(); |
|
126 | + if ($result === false) { |
|
127 | + throw SessionException::createFromPhpError(); |
|
128 | + } |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function session_write_close(): void |
147 | 147 | { |
148 | - error_clear_last(); |
|
149 | - $result = \session_write_close(); |
|
150 | - if ($result === false) { |
|
151 | - throw SessionException::createFromPhpError(); |
|
152 | - } |
|
148 | + error_clear_last(); |
|
149 | + $result = \session_write_close(); |
|
150 | + if ($result === false) { |
|
151 | + throw SessionException::createFromPhpError(); |
|
152 | + } |
|
153 | 153 | } |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | */ |
21 | 21 | function sqlsrv_begin_transaction($conn): void |
22 | 22 | { |
23 | - error_clear_last(); |
|
24 | - $result = \sqlsrv_begin_transaction($conn); |
|
25 | - if ($result === false) { |
|
26 | - throw SqlsrvException::createFromPhpError(); |
|
27 | - } |
|
23 | + error_clear_last(); |
|
24 | + $result = \sqlsrv_begin_transaction($conn); |
|
25 | + if ($result === false) { |
|
26 | + throw SqlsrvException::createFromPhpError(); |
|
27 | + } |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | */ |
43 | 43 | function sqlsrv_cancel($stmt): void |
44 | 44 | { |
45 | - error_clear_last(); |
|
46 | - $result = \sqlsrv_cancel($stmt); |
|
47 | - if ($result === false) { |
|
48 | - throw SqlsrvException::createFromPhpError(); |
|
49 | - } |
|
45 | + error_clear_last(); |
|
46 | + $result = \sqlsrv_cancel($stmt); |
|
47 | + if ($result === false) { |
|
48 | + throw SqlsrvException::createFromPhpError(); |
|
49 | + } |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | */ |
90 | 90 | function sqlsrv_client_info($conn): array |
91 | 91 | { |
92 | - error_clear_last(); |
|
93 | - $result = \sqlsrv_client_info($conn); |
|
94 | - if ($result === false) { |
|
95 | - throw SqlsrvException::createFromPhpError(); |
|
96 | - } |
|
97 | - return $result; |
|
92 | + error_clear_last(); |
|
93 | + $result = \sqlsrv_client_info($conn); |
|
94 | + if ($result === false) { |
|
95 | + throw SqlsrvException::createFromPhpError(); |
|
96 | + } |
|
97 | + return $result; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | */ |
108 | 108 | function sqlsrv_close($conn): void |
109 | 109 | { |
110 | - error_clear_last(); |
|
111 | - $result = \sqlsrv_close($conn); |
|
112 | - if ($result === false) { |
|
113 | - throw SqlsrvException::createFromPhpError(); |
|
114 | - } |
|
110 | + error_clear_last(); |
|
111 | + $result = \sqlsrv_close($conn); |
|
112 | + if ($result === false) { |
|
113 | + throw SqlsrvException::createFromPhpError(); |
|
114 | + } |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | */ |
132 | 132 | function sqlsrv_commit($conn): void |
133 | 133 | { |
134 | - error_clear_last(); |
|
135 | - $result = \sqlsrv_commit($conn); |
|
136 | - if ($result === false) { |
|
137 | - throw SqlsrvException::createFromPhpError(); |
|
138 | - } |
|
134 | + error_clear_last(); |
|
135 | + $result = \sqlsrv_commit($conn); |
|
136 | + if ($result === false) { |
|
137 | + throw SqlsrvException::createFromPhpError(); |
|
138 | + } |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | */ |
184 | 184 | function sqlsrv_configure(string $setting, $value): void |
185 | 185 | { |
186 | - error_clear_last(); |
|
187 | - $result = \sqlsrv_configure($setting, $value); |
|
188 | - if ($result === false) { |
|
189 | - throw SqlsrvException::createFromPhpError(); |
|
190 | - } |
|
186 | + error_clear_last(); |
|
187 | + $result = \sqlsrv_configure($setting, $value); |
|
188 | + if ($result === false) { |
|
189 | + throw SqlsrvException::createFromPhpError(); |
|
190 | + } |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | */ |
203 | 203 | function sqlsrv_execute($stmt): void |
204 | 204 | { |
205 | - error_clear_last(); |
|
206 | - $result = \sqlsrv_execute($stmt); |
|
207 | - if ($result === false) { |
|
208 | - throw SqlsrvException::createFromPhpError(); |
|
209 | - } |
|
205 | + error_clear_last(); |
|
206 | + $result = \sqlsrv_execute($stmt); |
|
207 | + if ($result === false) { |
|
208 | + throw SqlsrvException::createFromPhpError(); |
|
209 | + } |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | */ |
226 | 226 | function sqlsrv_free_stmt($stmt): void |
227 | 227 | { |
228 | - error_clear_last(); |
|
229 | - $result = \sqlsrv_free_stmt($stmt); |
|
230 | - if ($result === false) { |
|
231 | - throw SqlsrvException::createFromPhpError(); |
|
232 | - } |
|
228 | + error_clear_last(); |
|
229 | + $result = \sqlsrv_free_stmt($stmt); |
|
230 | + if ($result === false) { |
|
231 | + throw SqlsrvException::createFromPhpError(); |
|
232 | + } |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | |
@@ -253,16 +253,16 @@ discard block |
||
253 | 253 | */ |
254 | 254 | function sqlsrv_get_field($stmt, int $fieldIndex, int $getAsType = null) |
255 | 255 | { |
256 | - error_clear_last(); |
|
257 | - if ($getAsType !== null) { |
|
258 | - $result = \sqlsrv_get_field($stmt, $fieldIndex, $getAsType); |
|
259 | - } else { |
|
260 | - $result = \sqlsrv_get_field($stmt, $fieldIndex); |
|
261 | - } |
|
262 | - if ($result === false) { |
|
263 | - throw SqlsrvException::createFromPhpError(); |
|
264 | - } |
|
265 | - return $result; |
|
256 | + error_clear_last(); |
|
257 | + if ($getAsType !== null) { |
|
258 | + $result = \sqlsrv_get_field($stmt, $fieldIndex, $getAsType); |
|
259 | + } else { |
|
260 | + $result = \sqlsrv_get_field($stmt, $fieldIndex); |
|
261 | + } |
|
262 | + if ($result === false) { |
|
263 | + throw SqlsrvException::createFromPhpError(); |
|
264 | + } |
|
265 | + return $result; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -278,12 +278,12 @@ discard block |
||
278 | 278 | */ |
279 | 279 | function sqlsrv_next_result($stmt): ?bool |
280 | 280 | { |
281 | - error_clear_last(); |
|
282 | - $result = \sqlsrv_next_result($stmt); |
|
283 | - if ($result === false) { |
|
284 | - throw SqlsrvException::createFromPhpError(); |
|
285 | - } |
|
286 | - return $result; |
|
281 | + error_clear_last(); |
|
282 | + $result = \sqlsrv_next_result($stmt); |
|
283 | + if ($result === false) { |
|
284 | + throw SqlsrvException::createFromPhpError(); |
|
285 | + } |
|
286 | + return $result; |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | */ |
300 | 300 | function sqlsrv_num_fields($stmt): int |
301 | 301 | { |
302 | - error_clear_last(); |
|
303 | - $result = \sqlsrv_num_fields($stmt); |
|
304 | - if ($result === false) { |
|
305 | - throw SqlsrvException::createFromPhpError(); |
|
306 | - } |
|
307 | - return $result; |
|
302 | + error_clear_last(); |
|
303 | + $result = \sqlsrv_num_fields($stmt); |
|
304 | + if ($result === false) { |
|
305 | + throw SqlsrvException::createFromPhpError(); |
|
306 | + } |
|
307 | + return $result; |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | |
@@ -327,12 +327,12 @@ discard block |
||
327 | 327 | */ |
328 | 328 | function sqlsrv_num_rows($stmt): int |
329 | 329 | { |
330 | - error_clear_last(); |
|
331 | - $result = \sqlsrv_num_rows($stmt); |
|
332 | - if ($result === false) { |
|
333 | - throw SqlsrvException::createFromPhpError(); |
|
334 | - } |
|
335 | - return $result; |
|
330 | + error_clear_last(); |
|
331 | + $result = \sqlsrv_num_rows($stmt); |
|
332 | + if ($result === false) { |
|
333 | + throw SqlsrvException::createFromPhpError(); |
|
334 | + } |
|
335 | + return $result; |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | |
@@ -359,18 +359,18 @@ discard block |
||
359 | 359 | */ |
360 | 360 | function sqlsrv_prepare($conn, string $sql, array $params = null, array $options = null) |
361 | 361 | { |
362 | - error_clear_last(); |
|
363 | - if ($options !== null) { |
|
364 | - $result = \sqlsrv_prepare($conn, $sql, $params, $options); |
|
365 | - } elseif ($params !== null) { |
|
366 | - $result = \sqlsrv_prepare($conn, $sql, $params); |
|
367 | - } else { |
|
368 | - $result = \sqlsrv_prepare($conn, $sql); |
|
369 | - } |
|
370 | - if ($result === false) { |
|
371 | - throw SqlsrvException::createFromPhpError(); |
|
372 | - } |
|
373 | - return $result; |
|
362 | + error_clear_last(); |
|
363 | + if ($options !== null) { |
|
364 | + $result = \sqlsrv_prepare($conn, $sql, $params, $options); |
|
365 | + } elseif ($params !== null) { |
|
366 | + $result = \sqlsrv_prepare($conn, $sql, $params); |
|
367 | + } else { |
|
368 | + $result = \sqlsrv_prepare($conn, $sql); |
|
369 | + } |
|
370 | + if ($result === false) { |
|
371 | + throw SqlsrvException::createFromPhpError(); |
|
372 | + } |
|
373 | + return $result; |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | |
@@ -396,18 +396,18 @@ discard block |
||
396 | 396 | */ |
397 | 397 | function sqlsrv_query($conn, string $sql, array $params = null, array $options = null) |
398 | 398 | { |
399 | - error_clear_last(); |
|
400 | - if ($options !== null) { |
|
401 | - $result = \sqlsrv_query($conn, $sql, $params, $options); |
|
402 | - } elseif ($params !== null) { |
|
403 | - $result = \sqlsrv_query($conn, $sql, $params); |
|
404 | - } else { |
|
405 | - $result = \sqlsrv_query($conn, $sql); |
|
406 | - } |
|
407 | - if ($result === false) { |
|
408 | - throw SqlsrvException::createFromPhpError(); |
|
409 | - } |
|
410 | - return $result; |
|
399 | + error_clear_last(); |
|
400 | + if ($options !== null) { |
|
401 | + $result = \sqlsrv_query($conn, $sql, $params, $options); |
|
402 | + } elseif ($params !== null) { |
|
403 | + $result = \sqlsrv_query($conn, $sql, $params); |
|
404 | + } else { |
|
405 | + $result = \sqlsrv_query($conn, $sql); |
|
406 | + } |
|
407 | + if ($result === false) { |
|
408 | + throw SqlsrvException::createFromPhpError(); |
|
409 | + } |
|
410 | + return $result; |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | |
@@ -421,9 +421,9 @@ discard block |
||
421 | 421 | */ |
422 | 422 | function sqlsrv_rollback($conn): void |
423 | 423 | { |
424 | - error_clear_last(); |
|
425 | - $result = \sqlsrv_rollback($conn); |
|
426 | - if ($result === false) { |
|
427 | - throw SqlsrvException::createFromPhpError(); |
|
428 | - } |
|
424 | + error_clear_last(); |
|
425 | + $result = \sqlsrv_rollback($conn); |
|
426 | + if ($result === false) { |
|
427 | + throw SqlsrvException::createFromPhpError(); |
|
428 | + } |
|
429 | 429 | } |