Closed Erikvv closed 2 years ago
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
$ php --version
PHP 7.4.25 (cli) (built: Oct 23 2021 21:53:50) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.25, Copyright (c), by Zend Technologies
$ apt show libffi-dev
Package: libffi-dev
Version: 3.3-6
Priority: optional
Section: libdevel
Source: libffi
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Installed-Size: 308 kB
Depends: libffi7 (= 3.3-6)
Conflicts: libffi4-dev
(...)
root@nextcloud-web01:/usr/lib# apt show libffi7
Package: libffi7
Version: 3.3-6
Priority: optional
Section: libs
Source: libffi
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Installed-Size: 67.6 kB
Depends: libc6 (>= 2.14)
(...)
I have inserted the following code at the line before the error occurs:
var_dump($projectResult);
var_dump($projectResult->project);
And this gives the following output:
object(FFI\CData:struct UplinkProjectResult)#5429 (2) {
["project"]=>
object(FFI\CData:struct UplinkProject*)#5426 (1) {
[0]=>
object(FFI\CData:struct UplinkProject)#5425 (1) {
["_handle"]=>
int(2)
}
}
["error"]=>
NULL
}
object(FFI\CData:struct UplinkProject*)#5426 (1) {
[0]=>
object(FFI\CData:struct UplinkProject)#5425 (1) {
["_handle"]=>
int(2)
}
}
object(FFI\CData:struct UplinkProjectResult)#5403 (2) {
["project"]=>
object(FFI\CData:struct UplinkProject*)#5402 (1) {
[0]=>
object(FFI\CData:struct UplinkProject)#5401 (1) {
["_handle"]=>
int(4)
}
}
["error"]=>
NULL
}
object(FFI\CData:struct UplinkProject*)#5402 (1) {
[0]=>
object(FFI\CData:struct UplinkProject)#5401 (1) {
["_handle"]=>
int(4)
}
}
object(FFI\CData:struct UplinkProjectResult)#5379 (2) {
["project"]=>
object(FFI\CData:struct UplinkProject*)#5377 (1) {
[0]=>
object(FFI\CData:struct UplinkProject)#5378 (1) {
["_handle"]=>
int(6)
}
}
["error"]=>
NULL
}
object(FFI\CData:struct UplinkProject*)#5377 (1) {
[0]=>
object(FFI\CData:struct UplinkProject)#5378 (1) {
["_handle"]=>
int(6)
}
}
object(FFI\CData:struct UplinkProjectResult)#5378 (2) {
["project"]=>
object(FFI\CData:struct UplinkProject*)#5374 (1) {
[0]=>
object(FFI\CData:struct UplinkProject)#5376 (1) {
["_handle"]=>
int(8)
}
}
["error"]=>
NULL
}
object(FFI\CData:struct UplinkProject*)#5374 (1) {
[0]=>
object(FFI\CData:struct UplinkProject)#5376 (1) {
["_handle"]=>
int(8)
}
}
object(FFI\CData:struct UplinkProjectResult)#5375 (2) {
["project"]=>
object(FFI\CData:struct UplinkProject*)#5373 (1) {
[0]=>
object(FFI\CData:struct UplinkProject)#5370 (1) {
["_handle"]=>
int(10)
}
}
["error"]=>
NULL
}
int(0)
It shows that the line executes 4 times correctly but the 5th time it seems to have an issue dereferencing the pointer and it becomes int(0)
.
I observer that 5375 = 0x14FF which ends in 0b11111111 which may be interpreted as something unexpected.
I ran a Debian container with the exact same versions as listed and UplinkProjectResult as object #5375 but I was not able to reproduce the problem.
When I a cast to the correct type using FFI::cast("UplinkProject*", $var)
I am able to eliminate the problem at the line and the resulting CData object looks OK. However then garbage data pops up later in the code when the object is passed around.
Other things I've tried:
After a reinstall of the nextcloud storj app (including this library) things were fine again. I have no actionable items so I will close this issue and keep it in mind if someone reports a similar problem.
Error occurred when Stefan updated nextcloud with Storj as main storage. OS was unchanged.
This shouldn't ever happen.