Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
fusiondirectory
WebAuthn
Commits
9c85196e
Commit
9c85196e
authored
3 years ago
by
Lukas Buchs
Browse files
Options
Download
Patches
Plain Diff
PHP 8.1 Compatibility
Fix Serializable PHP 8.1 Compatibility Issue
parent
e5d9434a
master
v2.0.0-beta
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Binary/ByteBuffer.php
+23
-1
src/Binary/ByteBuffer.php
with
23 additions
and
1 deletion
+23
-1
src/Binary/ByteBuffer.php
+
23
−
1
View file @
9c85196e
...
@@ -211,7 +211,7 @@ class ByteBuffer implements \JsonSerializable, \Serializable {
...
@@ -211,7 +211,7 @@ class ByteBuffer implements \JsonSerializable, \Serializable {
/**
/**
* jsonSerialize interface
* jsonSerialize interface
* return binary data in RFC 1342-Like serialized string
* return binary data in RFC 1342-Like serialized string
* @return
\
st
dClass
* @return st
ring
*/
*/
public
function
jsonSerialize
()
{
public
function
jsonSerialize
()
{
if
(
ByteBuffer
::
$useBase64UrlEncoding
)
{
if
(
ByteBuffer
::
$useBase64UrlEncoding
)
{
...
@@ -239,6 +239,16 @@ class ByteBuffer implements \JsonSerializable, \Serializable {
...
@@ -239,6 +239,16 @@ class ByteBuffer implements \JsonSerializable, \Serializable {
$this
->
_length
=
\
strlen
(
$this
->
_data
);
$this
->
_length
=
\
strlen
(
$this
->
_data
);
}
}
/**
* (PHP 8 deprecates Serializable-Interface)
* @return array
*/
public
function
__serialize
()
{
return
[
'data'
=>
\
serialize
(
$this
->
_data
)
];
}
/**
/**
* object to string
* object to string
* @return string
* @return string
...
@@ -247,6 +257,18 @@ class ByteBuffer implements \JsonSerializable, \Serializable {
...
@@ -247,6 +257,18 @@ class ByteBuffer implements \JsonSerializable, \Serializable {
return
$this
->
getHex
();
return
$this
->
getHex
();
}
}
/**
* (PHP 8 deprecates Serializable-Interface)
* @param array $data
* @return void
*/
public
function
__unserialize
(
$data
)
{
if
(
$data
&&
isset
(
$data
[
'data'
]))
{
$this
->
_data
=
\
unserialize
(
$data
[
'data'
]);
$this
->
_length
=
\
strlen
(
$this
->
_data
);
}
}
// -----------------------
// -----------------------
// PROTECTED STATIC
// PROTECTED STATIC
// -----------------------
// -----------------------
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets