Ostico / PhpOrient

PhpOrient - Official Php driver based on the binary protocol of OrientDB.
Other
68 stars 37 forks source link

PHP 7: Uninitialized string offset: 0 #58

Closed ctoesca closed 7 years ago

ctoesca commented 8 years ago

Since I have upgraded PHP (v7), when I insert a vertex (with command() method) , I have this error: Uninitialized string offset: 0

The vertex is well created. The vertex I send is:

    Array ( [message] => TEST ORIENT [id] => 1 ) 

No problem with SELECT queries.

ctoesca commented 8 years ago

I patched CSV.php: line 227:

    if ($length > $i)
        $input = substr( $input, $i );

I don't know if it's the right way but it works.

smolinari commented 8 years ago

@ctoesca - have you run into any other issues with PHP7?

Scott

ctoesca commented 8 years ago

No other issues. But I use only command() and query() methods.

smolinari commented 8 years ago

Thanks for the info!

Scott

bazo commented 8 years ago

i have this same issue with select queries, some queries would throws this error also queries that executed ok, didn't have all data. when i ran the same sql in webadmin, all the data was here i downgraded to 1.2.3 nad this problem disappeared

redstrike commented 8 years ago

Will this issue be fixed? PHP 7 is the future, so I cannot leave it and back to PHP 5.6.

@ctoesca your patch works. Could you create a pull request? Maybe @Ostico will do a code review?

Ostico commented 8 years ago

Hi all. these days i will look for php7 full compatibility.

@ctoesca i will review/test your patch

haiflive commented 7 years ago

The same error on query (DEFAULT VALUES) INSERT INTO Goods CONTENT {"@class":"Goods","@version":0,"@rid":"#-1:-1"}

CSV.php line 32

if(!empty($input)) {
    $chunk              = self::eatKey( $input );
    $key                = $chunk[ 0 ];
    $input              = $chunk[ 1 ];
 }

I test this framework on PHP7, yet found only this two bugs

thenatsky commented 7 years ago

@ctoesca adding that 'if' statement has side effects later on the function. In the original code, $input is being overwritten to contain the "rest" of the param $input after a break in the for loop before.

There's logic afterwards that is using the now cutdown $input (the left-overs) but with your added if statement, that code is processing the original string, not the cutdown version.

Perhaps the if statement should encompass the rest of the code until just before the return?

Ostico commented 7 years ago

Php 7 supported in v1.2.5