nextcloud 13.0.5 RC 2
error: Uninitialized string offset: 0 at Node.php#290
fix : nextcloud/lib/private/Files/Node/Node.php
in line 290 add !$path ||
fixed function:
/**
* @param string $path
* @return string
*/
protected function normalizePath($path) {
if ($path === '' or $path === '/') {
return '/';
}
//no windows style slashes
$path = str_replace('\\', '/', $path);
//add leading slash
if (!$path || $path[0] !== '/') {
$path = '/' . $path;
}
//remove duplicate slashes
while (strpos($path, '//') !== false) {
$path = str_replace('//', '/', $path);
}
//remove trailing slash
$path = rtrim($path, '/');
return $path;
}
GitMate.io thinks a possibly related issue is https://github.com/nextcloud/server/issues/6335 (Undefined offset: 2).
@setar Do you mind to send this to us via pull request? Thanks a lot for finding it.
sorry, I do not want to do a fork project to fix one line
@setar Do you have any chance to debug this a bit? Where is the null coming from?
diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php
index d2232624b9..3b6857e64f 100644
--- a/lib/private/Files/Node/Node.php
+++ b/lib/private/Files/Node/Node.php
@@ -284,6 +284,10 @@ class Node implements \OCP\Files\Node {
* @return string
*/
protected function normalizePath($path) {
+ if ($path === null) {
+ \OC::$server->getLogger()->logException(new \Exception(), ['app' => 'debug-empty-path']);
+ return '/';
+ }
if ($path === '' or $path === '/') {
return '/';
}
This should help to log the stack trace.
@setar no need to fork the project. :) Github makes this very easy to simply do it online:
And that鈥檚 all :tada:
Thanks, its new knowledge for me :)
Hi,
I have also those errors with 13.0.6.
I can do the fix like @jancborchardt mentioned, but I haven't the knowledge in PHP. So I think it would be better if someone do the fix, who know want he do.
I am seeing the same errors on 13.0.6
How do I make this change? under vi, it says it is a read only file.
I see this on 14.0.1, fyi.
I added a PR. Please review!
I added a PR. Please review!
Okay - we should not fix the symptoms but actually the cause. In the proposed way the cause is simply hidden. 馃檲
Same problem here.
I just insterted the code snipped to trace this error down.
@MorrisJobke is the following information helpful?
Here one line raw data of my log file:
{
"reqId": "W7vC5kUEp9I8jo5E8Aa2jAAAAA4",
"level": 3,
"time": "2018-10-08T20:49:44+00:00",
"remoteAddr": "93.214.73.235",
"user": "georg",
"app": "debug-empty-path",
"method": "PUT",
"url": "/remote.php/dav/uploads/georg/2136506002/00000000",
"message": {
"Exception": "Exception",
"Message": "",
"Code": 0,
"Trace": [
{
"file": "/var/www/nextcloud/lib/private/Files/Node/Folder.php",
"line": 58,
"function": "normalizePath",
"class": "OC\\Files\\Node\\Node",
"type": "->",
"args": [
null
]
},
{
"file": "/var/www/nextcloud/lib/private/Files/Node/Folder.php",
"line": 133,
"function": "getFullPath",
"class": "OC\\Files\\Node\\Folder",
"type": "->",
"args": [
null
]
},
{
"file": "/var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php",
"line": 289,
"function": "get",
"class": "OC\\Files\\Node\\Folder",
"type": "->",
"args": [
null
]
},
{
"file": "/var/www/nextcloud/apps/files_fulltextsearch/lib/Events/FilesEvents.php",
"line": 74,
"function": "getFileFromPath",
"class": "OCA\\Files_FullTextSearch\\Service\\FilesService",
"type": "->",
"args": [
"georg",
null
]
},
{
"file": "/var/www/nextcloud/apps/files_fulltextsearch/lib/Hooks/FilesHooks.php",
"line": 67,
"function": "onNewFile",
"class": "OCA\\Files_FullTextSearch\\Events\\FilesEvents",
"type": "->",
"args": [
null
]
},
{
"file": "/var/www/nextcloud/lib/private/legacy/hook.php",
"line": 106,
"function": "onNewFile",
"class": "OCA\\Files_FullTextSearch\\Hooks\\FilesHooks",
"type": "::",
"args": [
{
"path": null
}
]
},
{
"file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php",
"line": 320,
"function": "emit",
"class": "OC_Hook",
"type": "::",
"args": [
"OC_Filesystem",
"post_create",
{
"path": null
}
]
},
{
"file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php",
"line": 252,
"function": "emitPostHooks",
"class": "OCA\\DAV\\Connector\\Sabre\\File",
"type": "->",
"args": [
false
]
},
{
"file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php",
"line": 156,
"function": "put",
"class": "OCA\\DAV\\Connector\\Sabre\\File",
"type": "->",
"args": [
null
]
},
{
"file": "/var/www/nextcloud/apps/dav/lib/Upload/UploadFolder.php",
"line": 39,
"function": "createFile",
"class": "OCA\\DAV\\Connector\\Sabre\\Directory",
"type": "->",
"args": [
"00000000",
null
]
},
{
"file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 1096,
"function": "createFile",
"class": "OCA\\DAV\\Upload\\UploadFolder",
"type": "->",
"args": [
"00000000",
null
]
},
{
"file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
"line": 529,
"function": "createFile",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": [
"uploads/georg/2136506002/00000000",
null,
null
]
},
{
"function": "httpPut",
"class": "Sabre\\DAV\\CorePlugin",
"type": "->",
"args": [
{
"absoluteUrl": "https://nextcloud.example.de/remote.php/dav/uploads/georg/2136506002/00000000",
"__class__": "Sabre\\HTTP\\Request"
},
{
"__class__": "Sabre\\HTTP\\Response"
}
]
},
{
"file": "/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php",
"line": 105,
"function": "call_user_func_array",
"args": [
[
{
"__class__": "Sabre\\DAV\\CorePlugin"
},
"httpPut"
],
[
{
"absoluteUrl": "https://nextcloud.example.de/remote.php/dav/uploads/georg/2136506002/00000000",
"__class__": "Sabre\\HTTP\\Request"
},
{
"__class__": "Sabre\\HTTP\\Response"
}
]
]
},
{
"file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 479,
"function": "emit",
"class": "Sabre\\Event\\EventEmitter",
"type": "->",
"args": [
"method:PUT",
[
{
"absoluteUrl": "https://nextcloud.example.de/remote.php/dav/uploads/georg/2136506002/00000000",
"__class__": "Sabre\\HTTP\\Request"
},
{
"__class__": "Sabre\\HTTP\\Response"
}
]
]
},
{
"file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 254,
"function": "invokeMethod",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": [
{
"absoluteUrl": "https://nextcloud.example.de/remote.php/dav/uploads/georg/2136506002/00000000",
"__class__": "Sabre\\HTTP\\Request"
},
{
"__class__": "Sabre\\HTTP\\Response"
}
]
},
{
"file": "/var/www/nextcloud/apps/dav/lib/Server.php",
"line": 293,
"function": "exec",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/apps/dav/appinfo/v2/remote.php",
"line": 35,
"function": "exec",
"class": "OCA\\DAV\\Server",
"type": "->",
"args": []
},
{
"file": "/var/www/nextcloud/remote.php",
"line": 163,
"args": [
"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"
],
"function": "require_once"
}
],
"File": "/var/www/nextcloud/lib/private/Files/Node/Node.php",
"Line": 288,
"CustomMessage": "--"
},
"userAgent": "Mozilla/5.0 (Windows) mirall/2.3.2 (build 1) (Nextcloud)",
"version": "14.0.1.1"
}
And here an image of my nextcloud log section:

Note: I don't know what the other two error messages are about, but for now, just ignore them. (Or give me a hint where they come from, because they are really spamming my log file :) )
Operating system: Linux 4.15.0-36-generic #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018 x86_64
Webserver: Apache/2.4.29 (Ubuntu) (fpm-fcgi)
Database: pgsql PostgreSQL 10.5 (Ubuntu 10.5-0ubuntu0.18.04) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0, 64-bit
PHP version:
7.2.10-0ubuntu0.18.04.1
Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, sodium, session, standard, cgi-fcgi, redis, PDO, xml, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, gmp, iconv, imagick, imap, intl, json, ldap, exif, pdo_pgsql, pgsql, Phar, posix, readline, shmop, SimpleXML, smbclient, soap, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip, libsmbclient, Zend OPcache
Nextcloud version: 14.0.1 - 14.0.1.1
Updated from an older Nextcloud/ownCloud or fresh install:
Freh install with github.com/nextcloud/vm script
Where did you install Nextcloud from: unknown
Signing status
Array
(
)
List of activated apps
Enabled:
- accessibility: 1.0.1
- activity: 2.7.0
- calendar: 1.6.2
- caniupdate: 0.2.0
- cloud_federation_api: 0.0.1
- comments: 1.4.0
- contacts: 2.1.6
- dav: 1.6.0
- federatedfilesharing: 1.4.0
- federation: 1.4.0
- files: 1.9.0
- files_fulltextsearch: 1.0.1
- files_pdfviewer: 1.3.2
- files_sharing: 1.6.2
- files_texteditor: 2.6.0
- files_trashbin: 1.4.1
- files_versions: 1.7.1
- files_videoplayer: 1.3.0
- firstrunwizard: 2.3.0
- fulltextsearch: 1.0.1
- fulltextsearch_elasticsearch: 1.0.1
- gallery: 18.1.0
- issuetemplate: 0.4.0
- logreader: 2.0.0
- lookup_server_connector: 1.2.0
- nextcloud_announcements: 1.3.0
- notifications: 2.2.1
- oauth2: 1.2.1
- onlyoffice: 2.0.4
- password_policy: 1.4.0
- previewgenerator: 1.1.0
- provisioning_api: 1.4.0
- serverinfo: 1.4.0
- sharebymail: 1.4.0
- support: 1.0.0
- survey_client: 1.2.0
- systemtags: 1.4.0
- tasks: 0.9.7
- theming: 1.5.0
- twofactor_backupcodes: 1.3.1
- updatenotification: 1.4.1
- workflowengine: 1.4.0
Disabled:
- admin_audit
- encryption
- files_external
- user_external
- user_ldap
Configuration (config/config.php)
{
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"localhost",
"XXX.XXX.XXX.XX",
"nextcloud.example.de",
"nextcloud.example.de"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "pgsql",
"version": "14.0.1.1",
"overwrite.cli.url": "https:\/\/nextcloud.example.de\/",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"instanceid": "***REMOVED SENSITIVE VALUE***",
"mail_smtpmode": "smtp",
"log_rotate_size": "10485760",
"memcache.local": "\\OC\\Memcache\\Redis",
"filelocking.enabled": true,
"memcache.distributed": "\\OC\\Memcache\\Redis",
"memcache.locking": "\\OC\\Memcache\\Redis",
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"port": 0,
"timeout": 0.5,
"dbindex": 0,
"password": "***REMOVED SENSITIVE VALUE***"
},
"htaccess.RewriteBase": "\/",
"loglevel": "2",
"log_type": "file",
"logfile": "\/mnt\/ncdata\/nextcloud.log",
"logtimezone": "Etc\/UTC",
"enable_previews": true,
"preview_libreoffice_path": "\/usr\/bin\/libreoffice",
"maintenance": false,
"onlyoffice": {
"verify_peer_off": true
},
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_smtpauthtype": "LOGIN",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpport": "587",
"mail_smtpauth": 1,
"mail_smtpname": "***REMOVED SENSITIVE VALUE***",
"mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
"mail_smtpsecure": "tls"
}
Are you using external storage, if yes which one: local/smb/sftp/...
No
Are you using encryption:
No
Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
Webdav
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0
@icewind1991 @rullzer looks suspicious. Any idea where this is coming from?
Maybe @danielkesselberg wants to dig into this 馃槈
i did the upgrade from 13.0.6 to 13.0.7 on 20th of Octobre 18. Since then i see those message into the nc-log -->
Error | PHP | Uninitialized string offset: 0 at /var/www/html/nextcloud/lib/private/Files/Node/Node.php#290 | 23 minutes ago
-- | -- | -- | --
Error | PHP | Uninitialized string offset: 0 at /var/www/html/nextcloud/lib/private/Files/Node/Node.php#290 | 23 minutes ago
Error | PHP | Uninitialized string offset: 0 at /var/www/html/nextcloud/lib/private/Files/Node/Node.php#290
Just a guess here, but I've seen numerous of errors when using the Full Text Search app. Not saying that it's the cause for this, but if everyone could confirm or deny if they use it or not maybe we have something to dig into.
I use it.
I also use it.
@setar @Tanarri @amicheals @feutl Do you use Full Text Search?
There are two apps about .. the "Full text search" and the "Full text search - Files" .. both are activated on my Cloud. I don't know if the " "#290" is indicating the Line number into the script .. when yes .. then it would be this function, which could be responsible for ..
protected function normalizePath($path) {
if ($path === '' or $path === '/') {
return '/';
}
//no windows style slashes
$path = str_replace('\', '/', $path);
//add leading slash
if ($path[0] !== '/') {
$path = '/' . $path;
}
//remove duplicate slashes
while (strpos($path, '//') !== false) {
$path = str_replace('//', '/', $path);
}
//remove trailing slash
$path = rtrim($path, '/');
return $path;
}
We already know that it is this function where the error comes up. The question is, where does it come from.
Therefore I modified the file with this function. (Have a look here)
You can see the stack trace. When I remember correctly, I wanted to upload a huge amount of data with the nextcloud client on my windows 10.
This is for example why we have this line here: "file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php" in the stack trace.
A bit later we see: "file": "/var/www/nextcloud/lib/private/legacy/hook.php",
and then the fulltextsearch app comes in: "file": "/var/www/nextcloud/apps/files_fulltextsearch/lib/Events/FilesEvents.php",
So I think @enoch85 is right. It has to do something with the fulltextsearch. @daita Could you have a look? :)
seems to be from above fulltextsearch: the path from the broadcasted event is null.
But I wrote a fix for files_fulltextsearch (NC14) to ignore events when the path is null.
Should be fine, but I'll do more test tomorrow:
_Note: still would be interesting to understand why the path is null_
Please upgrade your files_fulltextsearch to 1.1.0 (NC14)
i did the upgrade for: (i'm on NC 13.0.7)
Full text search 1.0.3
Full text search - Files 1.0.3
The Log still will be flooded ..
Error PHP Uninitialized string offset: 0 at /var/www/html/nextcloud/lib/private/Files/Node/Node.php#290 3 minutes ago
Error PHP Uninitialized string offset: 0 at /var/www/html/nextcloud/lib/private/Files/Node/Node.php#290 3 minutes ago
Error PHP Uninitialized string offset: 0 at /var/www/html/nextcloud/lib/private/Files/Node/Node.php#290 3 minutes ago
Error PHP Uninitialized string offset: 0 at /var/www/html/nextcloud/lib/private/Files/Node/Node.php#290 3 minutes ago
Error PHP Uninitialized string offset: 0 at /var/www/html/nextcloud/lib/private/Files/Node/Node.php#290 3 minutes ago
Error PHP Uninitialized string offset: 0 at /var/www/html/nextcloud/lib/private/Files/Node/Node.php#290 3 minutes ago
Error PHP Uninitialized string offset: 0 at /var/www/html/nextcloud/lib/private/Files/Node/Node.php#290 3 minutes ago
Error PHP Uninitialized string offset: 0 at /var/www/html/nextcloud/lib/private/Files/Node/Node.php#290 4 minutes ago
Error PHP Uninitialized string offset: 0 at /var/www/html/nextcloud/lib/private/Files/Node/Node.php#290 4 minutes ago
Error PHP Uninitialized string offset: 0 at /var/www/html/nextcloud/lib/private/Files/Node/Node.php#290 4 minutes ago
Error PHP Uninitialized string offset: 0 at /var/www/html/nextcloud/lib/private/Files/Node/Node.php#290 4 minutes ago
Thx for investigating ..
Thx for the hint upgrading the app .. currently i'm running nc 13.0.7 .. and Version 1.1.0 is not compatible with version 1.3, i think ( Required Nextcloud versions | >=14.0.0,<15.0.0 )
As the version of the software you've reported this for has reached end of life, I will close this ticket. If this is still happening after an upgrade to the latest version, feel free to reopen
Hei I am using NC 18.0.4. I currently activate ransomware recovery app and suddenly I get all those error messages:
Uninitialized string offset: 0 at /var/www/html/nextcloud/lib/private/Files/Node/Node.php#307
Undefined index: dirname at /var/www/html/nextcloud/apps/ransomware_detection/lib/Monitor.php#260
I observed the same issue as @Wotisrv, also with NC 18.0.4 and ransomware recovery app.
I second this, get my logfile spammed with these three errors:
Error PHP Uninitialized string offset: 0 at /var/www/path_to_nextcloud/lib/private/Files/Node/Node.php#307
Error PHP Undefined index: dirname at /var/www/path_to_nextcloud/apps/ransomware_detection/lib/Monitor.php#260
Error PHP Uninitialized string offset: 0 at /var/www/path_to_nextcloud/lib/private/Files/Node/Node.php#307
Same problem as last three comments.
NC 19.0.0 installed on Ubuntu 18.04
reopened in https://github.com/nextcloud/server/issues/23229
Still here
Most helpful comment
@setar no need to fork the project. :) Github makes this very easy to simply do it online:
And that鈥檚 all :tada: