Improve test behaviour

This commit is contained in:
Michael 2018-07-08 05:29:06 +00:00
parent 271b6cb8f9
commit 69db696ab1
3 changed files with 26 additions and 17 deletions

View file

@ -955,6 +955,8 @@ class dba {
* @return boolean Was the command executed successfully?
*/
public static function rollback() {
$ret = false;
switch (self::$driver) {
case 'pdo':
if (!self::$db->inTransaction()) {

View file

@ -412,11 +412,17 @@ class App
public function set_baseurl($url)
{
$parsed = @parse_url($url);
$hostname = '';
if (x($parsed)) {
if (!empty($parsed['scheme'])) {
$this->scheme = $parsed['scheme'];
}
if (!empty($parsed['host'])) {
$hostname = $parsed['host'];
}
if (x($parsed, 'port')) {
$hostname .= ':' . $parsed['port'];
}

View file

@ -781,12 +781,10 @@ class Image
$img_str = Network::fetchUrl($url, true, $redirects, 4);
$filesize = strlen($img_str);
// The tests are failing with an read error. This can be caused by memory shortage
// See https://stackoverflow.com/questions/10175758/getimagesize-read-error
// So we use the alternate method instead
//if (function_exists("getimagesizefromstring")) {
// $data = getimagesizefromstring($img_str);
//} else {
try {
if (function_exists("getimagesizefromstring")) {
$data = getimagesizefromstring($img_str);
} else {
$tempfile = tempnam(get_temppath(), "cache");
$a = get_app();
@ -796,7 +794,10 @@ class Image
$data = getimagesize($tempfile);
unlink($tempfile);
//}
}
} catch (Exception $e) {
return false;
}
if ($data) {
$data["size"] = $filesize;