Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e286d7f913 | |||
| e148a39902 | |||
| b7d5a79c3a | |||
| 9f8a86b4b0 |
@@ -1 +1 @@
|
|||||||
9.24.1
|
9.25.2
|
||||||
|
|||||||
@@ -363,11 +363,12 @@ class Session
|
|||||||
* set the auto write close flag
|
* set the auto write close flag
|
||||||
*
|
*
|
||||||
* @param bool $flag
|
* @param bool $flag
|
||||||
* @return void
|
* @return Session
|
||||||
*/
|
*/
|
||||||
public function setAutoWriteClose(bool $flag): void
|
public function setAutoWriteClose(bool $flag): Session
|
||||||
{
|
{
|
||||||
$this->auto_write_close = $flag;
|
$this->auto_write_close = $flag;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -513,14 +514,15 @@ class Session
|
|||||||
*
|
*
|
||||||
* @param string $name array name in _SESSION
|
* @param string $name array name in _SESSION
|
||||||
* @param mixed $value value to set (can be anything)
|
* @param mixed $value value to set (can be anything)
|
||||||
* @return void
|
* @return Session
|
||||||
*/
|
*/
|
||||||
public function set(string $name, mixed $value): void
|
public function set(string $name, mixed $value): Session
|
||||||
{
|
{
|
||||||
$this->checkValidSessionEntryKey($name);
|
$this->checkValidSessionEntryKey($name);
|
||||||
$this->restartSession();
|
$this->restartSession();
|
||||||
$_SESSION[$name] = $value;
|
$_SESSION[$name] = $value;
|
||||||
$this->closeSessionCall();
|
$this->closeSessionCall();
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -577,16 +579,17 @@ class Session
|
|||||||
* unset one _SESSION entry 'name' if exists
|
* unset one _SESSION entry 'name' if exists
|
||||||
*
|
*
|
||||||
* @param string $name _SESSION key name to remove
|
* @param string $name _SESSION key name to remove
|
||||||
* @return void
|
* @return Session
|
||||||
*/
|
*/
|
||||||
public function unset(string $name): void
|
public function unset(string $name): Session
|
||||||
{
|
{
|
||||||
if (!isset($_SESSION[$name])) {
|
if (!isset($_SESSION[$name])) {
|
||||||
return;
|
return $this;
|
||||||
}
|
}
|
||||||
$this->restartSession();
|
$this->restartSession();
|
||||||
unset($_SESSION[$name]);
|
unset($_SESSION[$name]);
|
||||||
$this->closeSessionCall();
|
$this->closeSessionCall();
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ class ConvertPlaceholder
|
|||||||
. '&&|' // array overlap
|
. '&&|' // array overlap
|
||||||
. '\-\|\-|' // range overlap for array
|
. '\-\|\-|' // range overlap for array
|
||||||
. '[^-]-{1}|' // single -, used in JSON too
|
. '[^-]-{1}|' // single -, used in JSON too
|
||||||
. '->|->>|#>|#>>|@>|<@|@@|@\?|\?{1}|\?\||\?&|#-'; //JSON searches, Array searchs, etc
|
. '->|->>|#>|#>>|@>|<@|@@|@\?|\?{1}|\?\||\?&|#-|' // JSON searches, Array searchs, etc
|
||||||
|
. 'THEN|ELSE' // command parts (CASE)
|
||||||
|
;
|
||||||
/** @var string the main regex including the pattern query split */
|
/** @var string the main regex including the pattern query split */
|
||||||
private const PATTERN_ELEMENT = '(?:\'.*?\')?\s*(?:' . self::PATTERN_QUERY_SPLIT . ')\s*';
|
private const PATTERN_ELEMENT = '(?:\'.*?\')?\s*(?:' . self::PATTERN_QUERY_SPLIT . ')\s*';
|
||||||
/** @var string comment regex
|
/** @var string comment regex
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class AsymmetricAnonymousEncryption
|
|||||||
* @return string
|
* @return string
|
||||||
* @throws \UnexpectedValueException key pair empty
|
* @throws \UnexpectedValueException key pair empty
|
||||||
* @throws \UnexpectedValueException invalid hex key pair
|
* @throws \UnexpectedValueException invalid hex key pair
|
||||||
* @throws \UnexpectedValueException key pair not correct size
|
* @throws \RangeException key pair not correct size
|
||||||
*/
|
*/
|
||||||
private function createKeyPair(
|
private function createKeyPair(
|
||||||
#[\SensitiveParameter]
|
#[\SensitiveParameter]
|
||||||
@@ -147,7 +147,7 @@ class AsymmetricAnonymousEncryption
|
|||||||
* @return string
|
* @return string
|
||||||
* @throws \UnexpectedValueException public key empty
|
* @throws \UnexpectedValueException public key empty
|
||||||
* @throws \UnexpectedValueException invalid hex key
|
* @throws \UnexpectedValueException invalid hex key
|
||||||
* @throws \UnexpectedValueException invalid key length
|
* @throws \RangeException invalid key length
|
||||||
*/
|
*/
|
||||||
private function createPublicKey(?string $public_key): string
|
private function createPublicKey(?string $public_key): string
|
||||||
{
|
{
|
||||||
@@ -256,13 +256,13 @@ class AsymmetricAnonymousEncryption
|
|||||||
* sets the private key for encryption
|
* sets the private key for encryption
|
||||||
*
|
*
|
||||||
* @param string $key_pair Key pair in hex
|
* @param string $key_pair Key pair in hex
|
||||||
* @return void
|
* @return AsymmetricAnonymousEncryption
|
||||||
* @throws \UnexpectedValueException key pair empty
|
* @throws \UnexpectedValueException key pair empty
|
||||||
*/
|
*/
|
||||||
public function setKeyPair(
|
public function setKeyPair(
|
||||||
#[\SensitiveParameter]
|
#[\SensitiveParameter]
|
||||||
string $key_pair
|
string $key_pair
|
||||||
) {
|
): AsymmetricAnonymousEncryption {
|
||||||
if (empty($key_pair)) {
|
if (empty($key_pair)) {
|
||||||
throw new \UnexpectedValueException('Key pair cannot be empty');
|
throw new \UnexpectedValueException('Key pair cannot be empty');
|
||||||
}
|
}
|
||||||
@@ -277,6 +277,7 @@ class AsymmetricAnonymousEncryption
|
|||||||
// check if valid
|
// check if valid
|
||||||
$this->createPublicKey($this->public_key);
|
$this->createPublicKey($this->public_key);
|
||||||
}
|
}
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -308,10 +309,10 @@ class AsymmetricAnonymousEncryption
|
|||||||
* extract the public key from the key pair
|
* extract the public key from the key pair
|
||||||
*
|
*
|
||||||
* @param string $public_key Public Key in hex
|
* @param string $public_key Public Key in hex
|
||||||
* @return void
|
* @return AsymmetricAnonymousEncryption
|
||||||
* @throws \UnexpectedValueException public key empty
|
* @throws \UnexpectedValueException public key empty
|
||||||
*/
|
*/
|
||||||
public function setPublicKey(string $public_key)
|
public function setPublicKey(string $public_key): AsymmetricAnonymousEncryption
|
||||||
{
|
{
|
||||||
if (empty($public_key)) {
|
if (empty($public_key)) {
|
||||||
throw new \UnexpectedValueException('Public key cannot be empty');
|
throw new \UnexpectedValueException('Public key cannot be empty');
|
||||||
@@ -320,6 +321,7 @@ class AsymmetricAnonymousEncryption
|
|||||||
$this->createPublicKey($public_key);
|
$this->createPublicKey($public_key);
|
||||||
$this->public_key = $public_key;
|
$this->public_key = $public_key;
|
||||||
sodium_memzero($public_key);
|
sodium_memzero($public_key);
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -209,13 +209,13 @@ class SymmetricEncryption
|
|||||||
* set a new key for encryption
|
* set a new key for encryption
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @return void
|
* @return SymmetricEncryption
|
||||||
* @throws \UnexpectedValueException key cannot be empty
|
* @throws \UnexpectedValueException key cannot be empty
|
||||||
*/
|
*/
|
||||||
public function setKey(
|
public function setKey(
|
||||||
#[\SensitiveParameter]
|
#[\SensitiveParameter]
|
||||||
string $key
|
string $key
|
||||||
) {
|
): SymmetricEncryption {
|
||||||
if (empty($key)) {
|
if (empty($key)) {
|
||||||
throw new \UnexpectedValueException('Key cannot be empty');
|
throw new \UnexpectedValueException('Key cannot be empty');
|
||||||
}
|
}
|
||||||
@@ -224,6 +224,7 @@ class SymmetricEncryption
|
|||||||
// set key
|
// set key
|
||||||
$this->key = $key;
|
$this->key = $key;
|
||||||
sodium_memzero($key);
|
sodium_memzero($key);
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5196,6 +5196,27 @@ final class CoreLibsDBIOTest extends TestCase
|
|||||||
SQL,
|
SQL,
|
||||||
'count' => 1,
|
'count' => 1,
|
||||||
'convert' => false,
|
'convert' => false,
|
||||||
|
],
|
||||||
|
'update with case' => [
|
||||||
|
'query' => <<<SQL
|
||||||
|
UPDATE table_with_primary_key SET
|
||||||
|
row_int = $1::INT,
|
||||||
|
row_varchar = CASE WHEN row_int = 1 THEN $2 ELSE 'bar'::VARCHAR END
|
||||||
|
WHERE
|
||||||
|
row_varchar = $3
|
||||||
|
SQL,
|
||||||
|
'count' => 3,
|
||||||
|
'convert' => false,
|
||||||
|
],
|
||||||
|
'select with case' => [
|
||||||
|
'query' => <<<SQL
|
||||||
|
SELECT row_int
|
||||||
|
FROM table_with_primary_key
|
||||||
|
WHERE
|
||||||
|
row_varchar = CASE WHEN row_int = 1 THEN $1 ELSE $2 END
|
||||||
|
SQL,
|
||||||
|
'count' => 2,
|
||||||
|
'convert' => false,
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user