Repository navigation
Closed
Labels
1. to developAccepted and waiting to be taken care ofAccepted and waiting to be taken care of25-feedbackbug
Milestone
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- Nextcloud Server is running on 64bit capable CPU, PHP and OS.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
I am using the official docker image nextcloud 25. I am getting all kinds of error PHP messages regarding of type string is deprecated at. It's happening on file uploads, when nextcloud sends email notifications as well. I think it's related to the new version 25 using PHP 8.1. It started happening for version 25. Didn't happen on version 24 which uses PHP 8.0.
Steps to reproduce
1.Send a test email notification.
2.Or upload a file.
3.Then check the logs to see the error messages.
Expected behavior
Should not be getting these error messages.
Installation method
Community Docker image
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.1
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Fresh Nextcloud Server install
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
{
"system": {
"htaccess.RewriteBase": "\/",
"memcache.local": "\\OC\\Memcache\\APCu",
"apps_paths": [
{
"path": "\/var\/www\/html\/apps",
"url": "\/apps",
"writable": false
},
{
"path": "\/var\/www\/html\/custom_apps",
"url": "\/custom_apps",
"writable": true
}
],
"overwriteprotocol": "https",
"instanceid": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"***REMOVED SENSITIVE VALUE***",
"***REMOVED SENSITIVE VALUE***"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "mysql",
"version": "25.0.0.18",
"overwrite.cli.url": "https:\/\/***REMOVED SENSITIVE VALUE***",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"maintenance": false,
"theme": "",
"loglevel": 2,
"default_phone_region": "US",
"defaultapp": "files",
"mail_smtpmode": "smtp",
"mail_smtpsecure": "tls",
"mail_sendmailmode": "smtp",
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_smtpauth": 1,
"mail_smtpauthtype": "LOGIN",
"mail_smtpport": "587",
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpname": "***REMOVED SENSITIVE VALUE***",
"mail_smtppassword": "***REMOVED SENSITIVE VALUE***"
}
}List of activated Apps
Enabled:
- activity: 2.17.0
- circles: 25.0.0
- cloud_federation_api: 1.8.0
- comments: 1.15.0
- contactsinteraction: 1.6.0
- dashboard: 7.5.0
- dav: 1.24.0
- federatedfilesharing: 1.15.0
- federation: 1.15.0
- files: 1.20.1
- files_pdfviewer: 2.6.0
- files_rightclick: 1.4.0
- files_sharing: 1.17.0
- files_trashbin: 1.15.0
- files_versions: 1.18.0
- firstrunwizard: 2.14.0
- logreader: 2.10.0
- lookup_server_connector: 1.13.0
- nextcloud_announcements: 1.14.0
- notifications: 2.13.1
- oauth2: 1.13.0
- onlyoffice: 7.6.8
- password_policy: 1.15.0
- photos: 2.0.0
- privacy: 1.9.0
- provisioning_api: 1.15.0
- recommendations: 1.4.0
- related_resources: 1.0.3
- serverinfo: 1.15.0
- settings: 1.7.0
- sharebymail: 1.15.0
- support: 1.8.0
- survey_client: 1.13.0
- systemtags: 1.15.0
- text: 3.6.0
- theming: 2.0.0
- twofactor_backupcodes: 1.14.0
- twofactor_totp: 7.0.0
- updatenotification: 1.15.0
- user_status: 1.5.0
- viewer: 1.9.0
- weather_status: 1.5.0
- workflowengine: 2.7.0
Disabled:
- admin_audit
- bruteforcesettings
- encryption
- files_external
- suspicious_login
- user_ldapNextcloud Signing status
No errors have been found.Nextcloud Logs
[PHP] Error: Error: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated at /var/www/html/lib/private/Files/Cache/Scanner.php#508 at <<closure>>
0. <<closure>>
OC\Log\ErrorHandler::onError(8192, "strpos(): Passi ... d", "/var/www/html/l ... p", 508)
1. /var/www/html/lib/private/Files/Cache/Scanner.php line 508
strpos(null, ".part/")
2. /var/www/html/lib/private/Files/View.php line 1384
OC\Files\Cache\Scanner::isPartialFile(null)
3. /var/www/html/lib/private/Files/Node/HookConnector.php line 227
OC\Files\View->getFileInfo(null)
4. /var/www/html/lib/private/Files/Node/HookConnector.php line 113
OC\Files\Node\HookConnector->getNodeForPath(null)
5. /var/www/html/lib/private/legacy/OC_Hook.php line 106
OC\Files\Node\HookConnector->postWrite([null])
6. /var/www/html/apps/dav/lib/Connector/Sabre/File.php line 471
OC_Hook::emit("OC_Filesystem", "post_write", [null])
7. /var/www/html/apps/dav/lib/Connector/Sabre/File.php line 398
OCA\DAV\Connector\Sabre\File->emitPostHooks(false)
8. /var/www/html/apps/dav/lib/Connector/Sabre/Directory.php line 151
OCA\DAV\Connector\Sabre\File->put(null)
9. /var/www/html/apps/dav/lib/Upload/UploadFolder.php line 45
OCA\DAV\Connector\Sabre\Directory->createFile("10485760", null)
10. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 1098
OCA\DAV\Upload\UploadFolder->createFile("10485760", null)
11. /var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 504
Sabre\DAV\Server->createFile("uploads/bmw/web ... 0", null, null)
12. /var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
13. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 472
Sabre\DAV\Server->emit("method:PUT", [Sabre\HTTP\Requ ... }])
14. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 253
Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
15. /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php line 321
Sabre\DAV\Server->start()
16. /var/www/html/apps/dav/lib/Server.php line 360
Sabre\DAV\Server->exec()
17. /var/www/html/apps/dav/appinfo/v2/remote.php line 35
OCA\DAV\Server->exec()
18. /var/www/html/remote.php line 167
require_once("/var/www/html/a ... p")Additional info
No response
Reacted by ZekuX, hoferbeck, Git'Fellow, Ondřej Lohniský, snow434, Jannick Oursin, Dino and EpochalEngineer
Metadata
Metadata
Assignees
Labels
1. to developAccepted and waiting to be taken care ofAccepted and waiting to be taken care of25-feedbackbug

Activity
szaimen commentedon Nov 3, 2022
cc @come-nc @nextcloud/server-backend
[-][Bug]: Error of type string is deprecated at - NC25[/-][+][Bug]: Passing null to string type is deprecated at - NC25[/+]come-nc commentedon Nov 3, 2022
Hello,
Yes, this warning is new to PHP 8.1 but should still not happen.
The error comes from some code calling isPartialFile with null instead of a string,
can you get the trace for one of these errors?[EDIT] My bad, the trace is at the end of the report, let me read that
come-nc commentedon Nov 3, 2022
So, looking at the trace:
I do not know if it is expected or not for the file instance there to have null in path property. I suspect it should not have null, or should not trigger hooks on the null path.
killerb77 commentedon Nov 8, 2022
It's definitely a PHP 8.1 issue. I built the docker container using php:8.0-apache-bullseye instead of the default php:8.1-apache-bullseye.
Everything works as it should without any of the error messages in the logs now, using PHP 8.0
come-nc commentedon Nov 8, 2022
The fact you see no error in PHP<8.1 does not mean there is no problem. Having this event fired with null path may have unexpected results in corner cases if it was not designed that way. We need to figure out if this is expected or not and fix either the listeners or the event.
PVince81 commentedon Nov 17, 2022
the stack trace looks like a chunked upload
solracsf commentedon Nov 24, 2022
Let me add 2 stack traces here if it helps.
@PVince81 in both cases, these seem to be uploads, and in both,
$fileis null.12 remaining items
killerb77 commentedon Dec 8, 2022
@come-nc "bmw" is a Nextcloud user id. Yes, it's the user that is uploading the file. "bmw" is also a user on the server. Also, since Nextcloud is running in docker, I have my docker compose file and static files in user bmw home directory. home/bmw/nextcloud25.
No, I am not uploading into a shared folder.
killerb77 commentedon Dec 25, 2022
@come-nc Any updates on this?
come-nc commentedon Jan 2, 2023
I am able to reproduce this.
It’s when chunk uploading a big file I think, the file is in uploads folder, and it tries to trigger hook on this path, which fails because it’s not relative to files/ folder.
We should either disable hooks on this uploads folder, or fix them to handle paths outside of files.
solracsf commentedon Jan 2, 2023
What do you call big files? On my side files not bigger than 10Mb triggers this. Sometimes. Sometimes don't...
[-][Bug]: Passing null to string type is deprecated at - NC25[/-][+][Bug]: `strpos()` and/or `pathinfo()`: Passing null to parameter #1 ($haystack) of type string is deprecated[/+]come-nc commentedon Jan 3, 2023
I meant any file that is uploaded by chunks, but maybe any file goes through the uploads folder, not sure.
tram98 commentedon Feb 19, 2023
I am also having this issue. I am on the latest version.
yehiashouman commentedon Feb 22, 2023
Using nextcloud:fpm official docker image (25.0.1). I am getting the same error in log.
I believe it is related to chunk uploads (Files larger than 10MB).
I tried modifying /var/www/html/lib/private/Files/Cache/Scanner.php (line 508)
to cast the $file as empty string than null but then got more errors in
substr(): Passing null to parameter #1 ($string) of type string is deprecated at /var/www/html/lib/private/Files/View.php#1149"
Reverted back to original code, then tried per documentation setting max chunk size to 0 from within container as www-data
php occ config:app:set files max_chunk_size --value 0that didn't work too.
Has anyone figured out a solution for this?
yehiashouman commentedon Feb 22, 2023
upgrading docker image (pulling, removing old image, building, starting) to latest (25.0.3) didn't fix it.
dinosmm commentedon Mar 17, 2023
I keep getting this error when uploading folders with more than a few files in them. It results in one or two files not uploading, which is hugely time-consuming as I need to go and find which folders have files missing afterwards.
Is this the same error as the one described here?
solracsf commentedon Mar 17, 2023
There is an ongoing patch (WiP) so stay tuned and follow it (subscribe) if needed.
#36893