Skip to content

Commit

Permalink
Fix PHP 7 incompatibilities
Browse files Browse the repository at this point in the history
  • Loading branch information
timoh6 committed Dec 4, 2015
1 parent 98a9b46 commit fc080ae
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
16 changes: 11 additions & 5 deletions README.markdown
Expand Up @@ -47,6 +47,12 @@ recommended. Composer is vulnerable to MITM attacks and at the time being,
TCrypto should be obtained only via secure connection using GitHub.


Backward incompatible changes
-----------------------------

04 Dec 2015 String() StorageHandler was renamed to PlainString().


TCrypto Keymanager and Keytool
------------------------------

Expand Down Expand Up @@ -145,16 +151,16 @@ $storage = new TCrypto\StorageHandler\Cookie();
// $storage = new TCrypto\StorageHandler\Cookie(false, 'my_cookie_name');

// or, to get TCrypto payload immediately back as a string:
// $storage = new TCrypto\StorageHandler\String();
// $storage = new TCrypto\StorageHandler\PlainString();
// $tcryptoPayload = $tcrypto->save();
// To feed back previously used TCrypto payload, pass it as a first argument to String():
// $storage = new TCrypto\StorageHandler\String($tcryptoPayload);
// To feed back previously used TCrypto payload, pass it as a first argument to PlainString():
// $storage = new TCrypto\StorageHandler\PlainString($tcryptoPayload);

// In short, you can save TCrypto payload to, say, a database
// (without the need to use a specific database StorageHandler).
// Then you can fetch the TCrypto payload from the database, and
// feed it back into TCrypto.
// NOTE, using String() StorageHandler will make
// NOTE, using PlainString() StorageHandler will make
// $tcrypto->save() to output the actual payload.

// Initialize encryption using either OpenSSL or Mcrypt (optional).
Expand Down Expand Up @@ -199,7 +205,7 @@ echo $tcrypto->getValue('object'); // "NULL"

// Saves the data to a storage.
$tcrypto->save();
// If String() StorageHandler is being used, $tcrypto->save() will output
// If PlainString() StorageHandler is being used, $tcrypto->save() will output
// the TCrypto payload (you need to store the payload by some other means).

// Destroys the data both from memory and storage.
Expand Down
Expand Up @@ -2,7 +2,7 @@
namespace TCrypto\StorageHandler;

/**
* String returns the TCrypto data as a plain string. The data will not be stored.
* PlainString returns the TCrypto data as a plain string. The data will not be stored.
*
* Possible use case: Use TCrypto to sign and encrypt data and pass the data back to your application.
* For example, you can encrypt user-specific third-party tokens before saving them into a database
Expand All @@ -11,7 +11,7 @@
* @author timoh <timoh6@gmail.com>
* @license Public Domain
*/
class String implements StorageInterface
class PlainString implements StorageInterface
{
/**
* @var string
Expand Down
4 changes: 2 additions & 2 deletions tests/TCrypto/StorageHandler/StringTest.php
Expand Up @@ -3,15 +3,15 @@ class TCrypto_StorageHandler_StringTest extends PHPUnit_Framework_TestCase
{
public function testReturnFalseOnEmpty()
{
$s = new TCrypto\StorageHandler\String('');
$s = new TCrypto\StorageHandler\PlainString('');
$data = $s->fetch();

$this->assertFalse($data);
}

public function testReturnFalseOnInvalidBase64Data()
{
$s = new TCrypto\StorageHandler\String('%');
$s = new TCrypto\StorageHandler\PlainString('%');
$data = $s->fetch();

$this->assertFalse($data);
Expand Down

0 comments on commit fc080ae

Please sign in to comment.