Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 7.4 reports "Trying to access array offset" messages #37303

Closed
phil-davis opened this issue Apr 24, 2020 · 4 comments · Fixed by #37311
Closed

PHP 7.4 reports "Trying to access array offset" messages #37303

phil-davis opened this issue Apr 24, 2020 · 4 comments · Fixed by #37311
Assignees

Comments

@phil-davis
Copy link
Contributor

phil-davis commented Apr 24, 2020

PHP 7.4 emits messages when code tries to access an array offset on a variable that is not an array. Previous PHP versions did not complain - but actually such code is bad and should be sorted out.

I will check the CI logs of PR #37302 for any of those and report them here.

Edit: checking done - the 2 posts below are what I found.

@phil-davis
Copy link
Contributor Author

phil-davis commented Apr 24, 2020

https://drone.owncloud.com/owncloud/core/24446/85/17

{"reqId":"gjHXY3KH2ySQRqGuqaLe","level":3,"time":"2020-04-24T06:17:37+00:00","remoteAddr":"192.168.16.8","user":"user1","app":"PHP","method":"POST","url":"\/ocs\/v1.php\/apps\/files_sharing\/api\/v1\/shares","message":"Trying to access array offset on value of type bool at \/drone\/src\/apps\/federatedfilesharing\/lib\/FederatedShareProvider.php#255"}
{"reqId":"gjHXY3KH2ySQRqGuqaLe","level":3,"time":"2020-04-24T06:17:37+00:00","remoteAddr":"192.168.16.8","user":"user1","app":"PHP","method":"POST","url":"\/ocs\/v1.php\/apps\/files_sharing\/api\/v1\/shares","message":"Trying to access array offset on value of type null at \/drone\/src\/apps\/federatedfilesharing\/lib\/FederatedShareProvider.php#255"}
{"reqId":"gjHXY3KH2ySQRqGuqaLe","level":3,"time":"2020-04-24T06:17:37+00:00","remoteAddr":"192.168.16.8","user":"user1","app":"PHP","method":"POST","url":"\/ocs\/v1.php\/apps\/files_sharing\/api\/v1\/shares","message":"Trying to access array offset on value of type null at \/drone\/src\/apps\/federatedfilesharing\/lib\/FederatedShareProvider.php#255"}
{"reqId":"g54yEx5JKJfrRrAvDXAa","level":3,"time":"2020-04-24T06:17:58+00:00","remoteAddr":"192.168.16.8","user":"user1","app":"PHP","method":"POST","url":"\/ocs\/v1.php\/apps\/files_sharing\/api\/v1\/shares","message":"Trying to access array offset on value of type bool at \/drone\/src\/apps\/federatedfilesharing\/lib\/FederatedShareProvider.php#255"}

Needs investigating.

And similar in https://drone.owncloud.com/owncloud/core/24446/127/18

{"reqId":"SQHYvY6n3kmhO4FPU8OK","level":3,"time":"2020-04-24T06:25:34+00:00","remoteAddr":"192.168.80.9","user":"user1","app":"PHP","method":"POST","url":"\/ocs\/v1.php\/apps\/files_sharing\/api\/v1\/shares","message":"Trying to access array offset on value of type bool at \/drone\/src\/apps\/federatedfilesharing\/lib\/FederatedShareProvider.php#255"}
{"reqId":"SQHYvY6n3kmhO4FPU8OK","level":3,"time":"2020-04-24T06:25:34+00:00","remoteAddr":"192.168.80.9","user":"user1","app":"PHP","method":"POST","url":"\/ocs\/v1.php\/apps\/files_sharing\/api\/v1\/shares","message":"Trying to access array offset on value of type null at \/drone\/src\/apps\/federatedfilesharing\/lib\/FederatedShareProvider.php#255"}

And https://drone.owncloud.com/owncloud/core/24446/130/18

@phil-davis phil-davis mentioned this issue Apr 24, 2020
11 tasks
@phil-davis
Copy link
Contributor Author

phil-davis commented Apr 24, 2020

In unit tests with sqlite owncloud log: https://drone.owncloud.com/owncloud/core/24446/36/8

{"reqId":"CPoh13iolBEwfrzbJU3E","level":3,"time":"2020-04-24T06:12:08+00:00","remoteAddr":"","user":"user1_Xxf3GHY9G0y8T","app":"no app in context","method":"--","url":"--","message":"Exception: {\"Exception\":\"PHPUnit\\\\Framework\\\\Error\\\\Notice\",\"Message\":\"Trying to access array offset on value of type null\",\"Code\":8,\"Trace\":\"
#0 \\\/drone\\\/src\\\/lib\\\/private\\\/Files\\\/Storage\\\/DAV.php(687): PHPUnit\\\\Util\\\\ErrorHandler::handleError()\\n
#1 \\\/drone\\\/src\\\/lib\\\/private\\\/Files\\\/Storage\\\/DAV.php(175): OC\\\\Files\\\\Storage\\\\DAV->simpleResponse()\\n
#2 \\\/drone\\\/src\\\/tests\\\/lib\\\/Files\\\/Storage\\\/DavTest.php(165): OC\\\\Files\\\\Storage\\\\DAV->mkdir()\\n
#3 \\\/drone\\\/src\\\/lib\\\/composer\\\/phpunit\\\/phpunit\\\/src\\\/Framework\\\/TestCase.php(1154): Test\\\\Files\\\\Storage\\\\DavTest->testInstantiateWebDavClient()\\n
#4 \\\/drone\\\/src\\\/lib\\\/composer\\\/phpunit\\\/phpunit\\\/src\\\/Framework\\\/TestCase.php(842): PHPUnit\\\\Framework\\\\TestCase->runTest()\\n
#5 \\\/drone\\\/src\\\/lib\\\/composer\\\/phpunit\\\/phpunit\\\/src\\\/Framework\\\/TestResult.php(693): PHPUnit\\\\Framework\\\\TestCase->runBare()\\n
#6 \\\/drone\\\/src\\\/lib\\\/composer\\\/phpunit\\\/phpunit\\\/src\\\/Framework\\\/TestCase.php(796): PHPUnit\\\\Framework\\\\TestResult->run()\\n
#7 \\\/drone\\\/src\\\/lib\\\/composer\\\/phpunit\\\/phpunit\\\/src\\\/Framework\\\/TestSuite.php(746): PHPUnit\\\\Framework\\\\TestCase->run()\\n
#8 \\\/drone\\\/src\\\/lib\\\/composer\\\/phpunit\\\/phpunit\\\/src\\\/Framework\\\/TestSuite.php(746): PHPUnit\\\\Framework\\\\TestSuite->run()\\n
#9 \\\/drone\\\/src\\\/lib\\\/composer\\\/phpunit\\\/phpunit\\\/src\\\/Framework\\\/TestSuite.php(746): PHPUnit\\\\Framework\\\\TestSuite->run()\\n
#10 \\\/drone\\\/src\\\/lib\\\/composer\\\/phpunit\\\/phpunit\\\/src\\\/TextUI\\\/TestRunner.php(652): PHPUnit\\\\Framework\\\\TestSuite->run()\\n
#11 \\\/drone\\\/src\\\/lib\\\/composer\\\/phpunit\\\/phpunit\\\/src\\\/TextUI\\\/Command.php(206): PHPUnit\\\\TextUI\\\\TestRunner->doRun()\\n
#12 \\\/drone\\\/src\\\/lib\\\/composer\\\/phpunit\\\/phpunit\\\/src\\\/TextUI\\\/Command.php(162): PHPUnit\\\\TextUI\\\\Command->run()\\n
#13 \\\/drone\\\/src\\\/lib\\\/composer\\\/phpunit\\\/phpunit\\\/phpunit(61): PHPUnit\\\\TextUI\\\\Command::main()\\n
#14 {main}\",\"File\":\"\\\/drone\\\/src\\\/lib\\\/private\\\/Files\\\/Storage\\\/DAV.php\",\"Line\":687}"}
{"reqId":"CPoh13iolBEwfrzbJU3E","level":3,"time":"2020-04-24T06:12:08+00:00","remoteAddr":"","user":"user1_Xxf3GHY9G0y8T","app":"files_external","method":"--","url":"--","message":"Trying to access array offset on value of type null"}

And there is similar in unit tests with mariaDB: https://drone.owncloud.com/owncloud/core/24446/37/9

@phil-davis
Copy link
Contributor Author

@VicDeo can you look at these? Or who?

@VicDeo VicDeo self-assigned this Apr 24, 2020
@VicDeo
Copy link
Member

VicDeo commented Apr 24, 2020

@phil-davis me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants