summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it.class6
-rw-r--r--it_debug.class3
-rw-r--r--it_url.class1
3 files changed, 6 insertions, 4 deletions
diff --git a/it.class b/it.class
index c4679b9..83cdfba 100644
--- a/it.class
+++ b/it.class
@@ -270,7 +270,7 @@ static function error($p = array(), $extra = null)
if (strlen($p['body']) > 500000 || it::match('[\x00-\x08\x0E-\x1F]', $p['body'], ['utf8' => false]) !== null)
{
@file_put_contents($datafn = "$home/tmp/error-" . substr(md5($p['body']), 0, 2), $p['body']); # NOPHPLINT
- $p['body'] = " See " . getenv('HOSTNAME') . ":$datafn";
+ $p['body'] = "see " . getenv('HOSTNAME') . ":$datafn";
}
$service = it::match('[^.]*', $GLOBALS['ULTRASITE']);
@@ -1185,7 +1185,7 @@ static function file_get($filename, $p = array())
{
if (isset($p['it_cache']) && ($key = "it_file_get_" . md5(json_encode([$filename, $p]))) && ($result = it_cache::get($key, $p['it_cache'])) !== null)
return $result;
- elseif (($data = it::file_get_contents($filename)) !== false)
+ elseif (($data = it::file_get_contents($filename == "-" ? "php://stdin" : $filename)) !== false)
{
if ($p['keyval'])
{
@@ -1318,7 +1318,7 @@ static function safe_filename($filename)
{
if (it::match("\.\./", $filename))
it::fatal(['title' => "../ contained in '$filename', aborted"]);
- $filename = it::replace(['^/dev/fd/(\d+)$' => 'php://fd/$1', '^-$' => 'php://stdin'], $filename);
+ $filename = it::replace(['^/dev/fd/(\d+)$' => 'php://fd/$1'], $filename);
return $filename;
}
diff --git a/it_debug.class b/it_debug.class
index 6cad9b5..8284093 100644
--- a/it_debug.class
+++ b/it_debug.class
@@ -120,6 +120,7 @@ static function setup()
* @param $p['color'] Allow color [true]
* @param $p['html'] Allow html [default based on REMOTE_ADDR]
* @param $p['short'] Omit variable names
+ * @param $p['print_r'] Use print_r instead of var_export (no escaping for strings)
* @return String representation of dump
*/
static function dump($args, $p = [])
@@ -170,7 +171,7 @@ static function dump($args, $p = [])
foreach ($args as $arg)
{
$var = array_shift($argnames);
- $item = gettype($arg) == 'resource' || is_array($arg) && isset($arg['GLOBALS']) || is_object($arg) && is_a($arg, "SimpleXMLElement") ? trim(print_r($arg, true)) : trim(var_export($arg, true));
+ $item = gettype($arg) == 'resource' || is_array($arg) && isset($arg['GLOBALS']) || is_object($arg) && is_a($arg, "SimpleXMLElement") || $p['print_r'] ? trim(print_r($arg, true)) : trim(var_export($arg, true));
# Replace PHP 5+ var_export object representation by old readable style
while (preg_match("#(.*\b)(\w+)::__set_state\(array\(([^()]+)\)\)(.*)#s", $item, $regs) && ++$iterations < 100)
diff --git a/it_url.class b/it_url.class
index a937212..26390eb 100644
--- a/it_url.class
+++ b/it_url.class
@@ -264,6 +264,7 @@ static function curl_opts($p=array())
$add += [CURLOPT_ENCODING => $p['accept_encoding']]; # NOTE: the curl library renamed the option to CURLOPT_ACCEPT_ENCODING, in php both are possible, CURLOPT_ENCODING is documented
return $add + [
+ CURLOPT_FORBID_REUSE => true,
CURLOPT_HEADER => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT_MS => $p['totaltimeout'] * 1000, # use _MS to support fractions of seconds