Skip to content

Error: Typed property Ehann\RedisRaw\AbstractRedisRawClient::$logger must not be accessed before initialization AbstractRedisRawClient.php:40 #4

@uweng

Description

@uweng

Using "redisearch-php" with this code :

<?php
require_once 'vendor/autoload.php';
use Ehann\RedisRaw\PhpRedisAdapter;
use Ehann\RediSearch\Index;

$redis = new PhpRedisAdapter();
$index = new Index($redis);

//Connecting to Redis server on localhost
 try
   {
     $redis->connect('127.0.0.1', 6379);
     echo "Successfull connect to Redis-Server!\n";
   } catch (Exception $e)
   {
     echo "Error connect to Redis-Server!\n";
   }
//Create Index if not allready exist
 try
   {
     $index->addTextField('sessionId')
          ->addTextField('timestamp')
          ->create();
     echo "Index 'logging' created!\n";
    } catch (Exception $e)
    {
      echo "Error create Index 'logging' !\n";
    }'

results in:
$ php ./bug.php

Successfull connect to Redis-Server!
PHP Fatal error:  Uncaught Error: Typed property Ehann\RedisRaw\AbstractRedisRawClient::$logger must not be accessed before initialization in /logging/vendor/ethanhann/redis-raw/src/AbstractRedisRawClient.php:40
Stack trace:
#0 /logging/vendor/ethanhann/redis-raw/src/PhpRedisAdapter.php(39): Ehann\RedisRaw\AbstractRedisRawClient->prepareRawCommandArguments('FT.CREATE', Array)
#1 /logging/vendor/ethanhann/redisearch-php/src/RediSearchRedisClient.php(109): Ehann\RedisRaw\PhpRedisAdapter->rawCommand('FT.CREATE', Array)
#2 /logging/vendor/ethanhann/redisearch-php/src/AbstractRediSearchClientAdapter.php(24): Ehann\RediSearch\RediSearchRedisClient->rawCommand('FT.CREATE', Array)
#3 /logging/vendor/ethanhann/redisearch-php/src/Index.php(75): Ehann\RediSearch\AbstractRediSearchClientAdapter->rawCommand('FT.CREATE', Array)
#4 /logging/bug.php(23): Ehann\RediSearch\Index->create()
#5 {main}
  thrown in /logging/vendor/ethanhann/redis-raw/src/AbstractRedisRawClient.php on line 40

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions