Composer libs update

This commit is contained in:
Clemens Schwaighofer
2023-09-01 18:36:22 +09:00
parent e74bd04d6f
commit c0db3be770
33 changed files with 698 additions and 417 deletions

View File

@@ -99,7 +99,7 @@ echo "<hr>";
try {
$check = Colors::validateColor('#ab12cd', 99);
print "No Exception";
} catch (\Exception $e) {
} catch (\UnexpectedValueException $e) {
print "ERROR: " . $e->getCode() . ": " . $e->getMessage() . "<br>";
}

View File

@@ -39,8 +39,18 @@ print '<div><h1>' . $PAGE_NAME . '</h1></div>';
// define a list of from to color sets for conversion test
// A(out of bounds)
print "C::S/COLOR invalid rgb->hex (gray 125): -1, -1, -1: " . CoreLibs\Convert\Colors::rgb2hex(-1, -1, -1) . "<br>";
print "\$C::S/COLOR invalid rgb->hex (gray 125): -1, -1, -1: " . $color_class::rgb2hex(-1, -1, -1) . "<br>";
try {
print "C::S/COLOR invalid rgb->hex (gray 125): -1, -1, -1: "
. CoreLibs\Convert\Colors::rgb2hex(-1, -1, -1) . "<br>";
} catch (\LengthException $e) {
print "*Exception: " . $e->getMessage() . "<br>" . $e . "<br>";
}
try {
print "\$C::S/COLOR invalid rgb->hex (gray 125): -1, -1, -1: "
. $color_class::rgb2hex(-1, -1, -1) . "<br>";
} catch (\LengthException $e) {
print "**Exception: " . $e->getMessage() . "<br><pre>" . print_r($e, true) . "</pre><br>";
}
// B(valid)
$rgb = [10, 20, 30];
$hex = '#0a141e';

View File

@@ -75,6 +75,14 @@ $db->dbResetEncoding();
// empty calls, none of the below should fail
//
$db->dbGetCursor();
//
$db->dbGetCursorExt();
//
$db->dbGetCursorPos('SELECT foo', ['bar']);
//
$db->dbGetCursorNumRows('SELECT foo', ['bar']);
//
$db->dbGetInsertPKName();
//
$db->dbGetInsertPK();

View File

@@ -109,6 +109,13 @@ foreach ($images as $image) {
echo "<hr>";
}
// errros
try {
Image::createThumbnailSimple('', $thumb_width, 0, $cache_folder, $web_folder);
} catch (\UnexpectedValueException $e) {
print "Message:<br>" . $e->getMessage() . "<br>" . $e . "<br>";
}
print "</body></html>";
// __END__

View File

@@ -78,16 +78,18 @@ if (isset($_SESSION)) {
#
print "[UNSET] To set session name valid: "
. ($session->checkValidSessionName($session_name) ? 'Valid' : 'Invalid') . "<br>";
if (false === ($session_id = $session->startSession($session_name))) {
print "[FAILED] Session start failed: " . $session->getErrorStr() . "<br>";
} else {
try {
$session_id = $session->startSession($session_name);
print "[SET] Current session id: " . $session_id . "<br>";
} catch (\Exception $e) {
print "[FAILED] Session start failed:<br>" . $e->getMessage() . "<br>" . $e . "<br>";
}
// set again
if (false === ($session_id = $session->startSession($session_name))) {
print "[2 FAILED] Session start failed: " . $session->getErrorStr() . "<br>";
} else {
try {
$session_id = $session->startSession($session_name);
print "[2 SET] Current session id: " . $session_id . "<br>";
} catch (\Exception $e) {
print "[2 FAILED] Session start failed:<br>" . $e->getMessage() . "<br>" . $e . "<br>";
}
print "[SET] Current session id: " . $session->getSessionId() . "<br>";
print "[SET] Current session name: " . $session->getSessionName() . "<br>";
@@ -125,10 +127,11 @@ print "[READ MAGIC] unset Isset: " . (isset($session->setwrap) ? 'Yes' : 'No') .
// differnt session name
$session_name = 'class-test-session-ALT';
if (false === ($session_id = $session->startSession($session_name))) {
print "[3 FAILED] Session start failed: " . $session->getErrorStr() . "<br>";
} else {
try {
$session_id = $session->startSession($session_name);
print "[3 SET] Current session id: " . $session_id . "<br>";
} catch (\Exception $e) {
print "[3 FAILED] Session start failed:<br>" . $e->getMessage() . "<br>" . $e . "<br>";
}
print "[SET AGAIN] Current session id: " . $session->getSessionId() . "<br>";
@@ -141,10 +144,11 @@ $_SESSION['will_never_be_written'] = 'empty';
// open again
$session_name = 'class-test-session';
if (false === ($session_id = $session->startSession($session_name))) {
print "[4 FAILED] Session start failed: " . $session->getErrorStr() . "<br>";
} else {
try {
$session_id = $session->startSession($session_name);
print "[4 SET] Current session id: " . $session_id . "<br>";
} catch (\Exception $e) {
print "[4 FAILED] Session start failed:<br>" . $e->getMessage() . "<br>" . $e . "<br>";
}
print "[START AGAIN] Current session id: " . $session->getSessionId() . "<br>";
$_SESSION['will_be_written_again'] = 'Full';
@@ -153,10 +157,11 @@ $_SESSION['will_be_written_again'] = 'Full';
$session->writeClose();
// invalid
$session_name = '123';
if (false === ($session_id = $session->startSession($session_name))) {
print "[5 FAILED] Session start failed: " . $session->getErrorStr() . "<br>";
} else {
try {
$session_id = $session->startSession($session_name);
print "[5 SET] Current session id: " . $session_id . "<br>";
} catch (\Exception $e) {
print "[5 FAILED] Session start failed:<br>" . $e->getMessage() . "<br>" . $e . "<br>";
}
print "[BAD NAME] Current session id: " . $session->getSessionId() . "<br>";
print "[BAD NAME] Current session name: " . $session->getSessionName() . "<br>";

View File

@@ -69,16 +69,18 @@ print "[UNSET] Current session status: " . getSessionStatusString($session->getS
print "[READ] " . $var . ": " . ($_SESSION[$var] ?? '{UNSET}') . "<br>";
// start
if (false === ($session_id = $session->startSession($session_name))) {
print "Session start failed: " . $session->getErrorStr() . "<br>";
} else {
print "Current session id: " . $session_id . "<br>";
try {
$session_id = $session->startSession($session_name);
print "[1] Current session id: " . $session_id . "<br>";
} catch (\Exception $e) {
print "[1] Session start failed:<br>" . $e->getMessage() . "<br>" . $e . "<br>";
}
// set again
if (false === ($session_id = $session->startSession($session_name))) {
print "[2] Session start failed<br>";
} else {
try {
$session_id = $session->startSession($session_name);
print "[2] Current session id: " . $session_id . "<br>";
} catch (\Exception $e) {
print "[2] Session start failed:<br>" . $e->getMessage() . "<br>" . $e . "<br>";
}
print "[SET] Current session id: " . $session->getSessionId() . "<br>";
print "[SET] Current session name: " . $session->getSessionName() . "<br>";