Skip to content

Commit 0fe27e0

Browse files
authored
Merge pull request #32 from moufmouf/getcwd
Extend detection of falsy functions (2)
2 parents 580dbf3 + 89ee853 commit 0fe27e0

40 files changed

+3421
-9
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $ svn update
2323

2424
### Generating the functions
2525

26-
Generating the functions can be done with a simple command line.
26+
Generating the functions can be done with a simple command.
2727

2828
```bash
2929
$ cd generator

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"generated/bzip2.php",
1717
"generated/classobj.php",
1818
"generated/com.php",
19+
"generated/cubrid.php",
1920
"generated/curl.php",
2021
"generated/datetime.php",
2122
"generated/dir.php",
@@ -76,6 +77,7 @@
7677
"generated/spl.php",
7778
"generated/sqlsrv.php",
7879
"generated/ssh2.php",
80+
"generated/stats.php",
7981
"generated/stream.php",
8082
"generated/strings.php",
8183
"generated/swoole.php",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
namespace Safe\Exceptions;
3+
4+
class CubridException extends AbstractSafeException
5+
{
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
namespace Safe\Exceptions;
3+
4+
class StatsException extends AbstractSafeException
5+
{
6+
}

generated/apache.php

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,47 @@ function apache_get_version(): string
2222
}
2323

2424

25+
/**
26+
* Retrieve an Apache environment variable specified by
27+
* variable.
28+
*
29+
* This function requires Apache 2 otherwise it's undefined.
30+
*
31+
* @param string $variable The Apache environment variable
32+
* @param bool $walk_to_top Whether to get the top-level variable available to all Apache layers.
33+
* @return string The value of the Apache environment variable on success,
34+
* @throws ApacheException
35+
*
36+
*/
37+
function apache_getenv(string $variable, bool $walk_to_top = false): string
38+
{
39+
error_clear_last();
40+
$result = \apache_getenv($variable, $walk_to_top);
41+
if ($result === false) {
42+
throw ApacheException::createFromPhpError();
43+
}
44+
return $result;
45+
}
46+
47+
48+
/**
49+
* Fetches all HTTP request headers from the current request.
50+
*
51+
* @return array An associative array of all the HTTP headers in the current request, .
52+
* @throws ApacheException
53+
*
54+
*/
55+
function apache_request_headers(): array
56+
{
57+
error_clear_last();
58+
$result = \apache_request_headers();
59+
if ($result === false) {
60+
throw ApacheException::createFromPhpError();
61+
}
62+
return $result;
63+
}
64+
65+
2566
/**
2667
* apache_reset_timeout resets the Apache write timer,
2768
* which defaults to 300 seconds. With set_time_limit(0);
@@ -81,3 +122,52 @@ function apache_setenv(string $variable, string $value, bool $walk_to_top = fals
81122
throw ApacheException::createFromPhpError();
82123
}
83124
}
125+
126+
127+
/**
128+
* Fetches all HTTP headers from the current request.
129+
*
130+
* This function is an alias for apache_request_headers.
131+
* Please read the apache_request_headers
132+
* documentation for more information on how this function works.
133+
*
134+
* @return array An associative array of all the HTTP headers in the current request, .
135+
* @throws ApacheException
136+
*
137+
*/
138+
function getallheaders(): array
139+
{
140+
error_clear_last();
141+
$result = \getallheaders();
142+
if ($result === false) {
143+
throw ApacheException::createFromPhpError();
144+
}
145+
return $result;
146+
}
147+
148+
149+
/**
150+
* virtual is an Apache-specific function which
151+
* is similar to &lt;!--#include virtual...--&gt; in
152+
* mod_include.
153+
* It performs an Apache sub-request. It is useful for including
154+
* CGI scripts or .shtml files, or anything else that you would
155+
* parse through Apache. Note that for a CGI script, the script
156+
* must generate valid CGI headers. At the minimum that means it
157+
* must generate a Content-Type header.
158+
*
159+
* To run the sub-request, all buffers are terminated and flushed to the
160+
* browser, pending headers are sent too.
161+
*
162+
* @param string $filename The file that the virtual command will be performed on.
163+
* @throws ApacheException
164+
*
165+
*/
166+
function virtual(string $filename): void
167+
{
168+
error_clear_last();
169+
$result = \virtual($filename);
170+
if ($result === false) {
171+
throw ApacheException::createFromPhpError();
172+
}
173+
}

generated/apc.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,23 @@ function apc_load_constants(string $key, bool $case_sensitive = true): void
188188
throw ApcException::createFromPhpError();
189189
}
190190
}
191+
192+
193+
/**
194+
* Retrieves APC's Shared Memory Allocation information.
195+
*
196+
* @param bool $limited When set to FALSE (default) apc_sma_info will
197+
* return a detailed information about each segment.
198+
* @return array Array of Shared Memory Allocation data; FALSE on failure.
199+
* @throws ApcException
200+
*
201+
*/
202+
function apc_sma_info(bool $limited = false): array
203+
{
204+
error_clear_last();
205+
$result = \apc_sma_info($limited);
206+
if ($result === false) {
207+
throw ApcException::createFromPhpError();
208+
}
209+
return $result;
210+
}

generated/apcu.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,23 @@ function apcu_inc(string $key, int $step = 1, bool &$success = null): int
9090
}
9191
return $result;
9292
}
93+
94+
95+
/**
96+
* Retrieves APCu Shared Memory Allocation information.
97+
*
98+
* @param bool $limited When set to FALSE (default) apcu_sma_info will
99+
* return a detailed information about each segment.
100+
* @return array Array of Shared Memory Allocation data; FALSE on failure.
101+
* @throws ApcuException
102+
*
103+
*/
104+
function apcu_sma_info(bool $limited = false): array
105+
{
106+
error_clear_last();
107+
$result = \apcu_sma_info($limited);
108+
if ($result === false) {
109+
throw ApcuException::createFromPhpError();
110+
}
111+
return $result;
112+
}

0 commit comments

Comments
 (0)