View Issue Details

IDProjectCategoryView StatusLast Update
0000023SIP Trip PhoneSIP Trip Phonepublic2025-05-13 19:30
Reportermatt Assigned To 
PrioritynormalSeveritycrashReproducibilityalways
Status newResolutionopen 
PlatformnextcloudOS Version30.0.5.1 
Summary0000023: 500 Error when attempting to load app
DescriptionI am getting an internal server error when attempting to load the app.

The following is shown in the logs:

{"reqId":"mtg4T1gbRbvZJ71MXsZd","level":3,"time":"2025-01-17T15:46:02+00:00","remoteAddr":"XX.XX.XX.XX","user":"matt","app":"index","method":"GET","url":"/apps/sip_trip_phone/user/getcontactsnmbrs/%3C?php%20p($userId)&%20?%3E","message":"preg_split(): Argument #2 ($subject) must be of type string, resource given in file '/var/www/html/apps/sip_trip_phone/lib/Service/SphoneService.php' line 122","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0","version":"30.0.5.1","exception":{"Exception":"Exception","Message":"preg_split(): Argument #2 ($subject) must be of type string, resource given in file '/var/www/html/apps/sip_trip_phone/lib/Service/SphoneService.php' line 122","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\SIPTripPhone\\Controller\\SphoneController"},"getcontactsnmbrs"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\SIPTripPhone\\Controller\\SphoneController","getcontactsnmbrs",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"userId":"<","_route":"sip_trip_phone.sphone.getcontactsnmbrs"}]},{"file":"/var/www/html/lib/base.php","line":1003,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/sip_trip_phone/user/getcontactsnmbrs/%3C"]},{"file":"/var/www/html/index.php","line":24,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":146,"Previous":{"Exception":"TypeError","Message":"preg_split(): Argument #2 ($subject) must be of type string, resource given","Code":0,"Trace":[{"file":"/var/www/html/apps/sip_trip_phone/lib/Service/SphoneService.php","line":122,"function":"preg_split","args":["/\\r\\n|\\r|\\n/",null]},{"file":"/var/www/html/apps/sip_trip_phone/lib/Controller/SphoneController.php","line":87,"function":"getcontactsnmbrs","class":"OCA\\SIPTripPhone\\Service\\SphoneService","type":"->","args":["matt"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":208,"function":"getcontactsnmbrs","class":"OCA\\SIPTripPhone\\Controller\\SphoneController","type":"->","args":["<"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\SIPTripPhone\\Controller\\SphoneController"},"getcontactsnmbrs"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\SIPTripPhone\\Controller\\SphoneController"},"getcontactsnmbrs"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\SIPTripPhone\\Controller\\SphoneController","getcontactsnmbrs",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"userId":"<","_route":"sip_trip_phone.sphone.getcontactsnmbrs"}]},{"file":"/var/www/html/lib/base.php","line":1003,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/sip_trip_phone/user/getcontactsnmbrs/%3C"]},{"file":"/var/www/html/index.php","line":24,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/apps/sip_trip_phone/lib/Service/SphoneService.php","Line":122},"message":"preg_split(): Argument #2 ($subject) must be of type string, resource given in file '/var/www/html/apps/sip_trip_phone/lib/Service/SphoneService.php' line 122","exception":{},"CustomMessage":"preg_split(): Argument #2 ($subject) must be of type string, resource given in file '/var/www/html/apps/sip_trip_phone/lib/Service/SphoneService.php' line 122"}}

I have attempted to change line: https://git.doublebastion.com/sip-trip-phone/blob/develop/lib/Service/SphoneService.php#L110
From: "FROM `*PREFIX*cards`"
To: "FROM `oc_cards`"

to match the database prefix I have but I am still getting the same.

If you need any more info please ask.
Steps To ReproduceAttempt to load SIP trip phone on the latest version (1.1.7)
TagsNo tags attached.

Activities

matt

2025-01-17 16:14

reporter   ~0000073

Sorry: Dup of 0000021

DoubleBastionAdmin

2025-01-17 21:11

administrator   ~0000074

On your server the second query in the 'getcontactsnmbrs' function, in the 'SphoneService.php' file fails to get the data from the 'oc_cards' table. We can't reproduce your issue. You are probably using a different version of MariaDB or PHP. If you log in to your phpMyAdmin, click on the 'oc_cards' table, and click on any blob on the 'carddata' column, can you download the bin file and open it with a text editor to see the vcard data ?

matt

2025-05-13 14:20

reporter   ~0000107

Hi,

The card data appears to be there and exists for all my rows ...

```
nextcloud=# select count(carddata) from oc_cards where carddata like '%BEGIN%';
 count
-------
   312
(1 row)


nextcloud=# select count(carddata) from oc_cards;
 count
-------
   312
(1 row)
```

I'm using postgres as the nextcloud database, would that be causing the issue? The version is ...

```
$ docker exec -ti nextcloud-db bash
root@53476f835f13:/# postgres -V
postgres (PostgreSQL) 15.2 (Debian 15.2-1.pgdg110+1)
```

```
nextcloud=# SHOW SERVER_ENCODING;
 server_encoding
-----------------
 UTF8
(1 row)
```


I think I will try and upgrade to 17 a bit later and see if that helps.

matt

2025-05-13 15:30

reporter   ~0000108

If I try the following ...

                 echo var_dump($ctdatarow);
                 echo '
';
                 echo var_dump($ctdatarow['carddata']);

I get this result ...

array(2) { ["carddata"]=> resource(15) of type (stream) ["uid"]=> string(36) "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" }
resource(15) of type (stream)

PHP Version => 8.3.20

matt

2025-05-13 15:47

reporter   ~0000109

Maybe something like the following:

                 if (get_resource_type($ctdatarow['carddata'] == "stream") {
                          $carddatastreamcontent = stream_get_contents($ctdatarow['carddata'], -1, 0);
                          $ctdatarr = preg_split('/\r\n|\r|\n/', $carddatastreamcontent);
                 } else {
                          $ctdatarr = preg_split('/\r\n|\r|\n/', $ctdatarow['carddata']);
                 }

I'm not really setup to test this though as I am currently running in a docker container.

The card data that it is attempting to pull is my contact, the initial one that was created with nextcloud which has a large photo attached to it, the total card data size is 125 KB which might be write its returning a handle to a stream as its expecting it to be buffered? I'm also not a PHP developer so just guessing a bit here.

DoubleBastionAdmin

2025-05-13 19:30

administrator   ~0000110

There are always multiple ways of doing the same thing, but always one of them is the best: the one that achieves the most with the least effort. On SIP Trip Phone's official page (https://www.doublebastion.com/sip-trip-phone/) we state that the first requirement for SIP Trip Phone is to have Nextcloud installed and configured preferably by following the 'Install Nextcloud' chapter of our guide (https://www.doublebastion.com/install-nextcloud/). There we describe the best method of installing Nextcloud. This means that we highly recommend installing Nextcloud directly on the server, not in a Docker container, and using MariaDB and not PostgreSQL.

As mentioned, we can't reproduce your error which seems to be caused by the way Nextcloud saves card data to the database when PostgreSQL is the database management system instead of MariaDB. The 'carddata' column of the 'oc_cards' table should contain blobs of type 'longblob' not other type of data. SIP Trip Phone has never been tested with PostgreSQL. Since we can't support all methods of installing Nextcloud we support the best, which is described in our guide: you install Nextcloud directly on the server on top of a LEMP stack and you get maximum control over what you install, maximum efficiency and the least amount of errors and troubles down the road. LEMP means Linux, Nginx, MariaDB/MySQL and PHP. So, PostgreSQL is not there.

Issue History

Date Modified Username Field Change
2025-01-17 16:12 matt New Issue
2025-01-17 16:14 matt Note Added: 0000073
2025-01-17 21:11 DoubleBastionAdmin Note Added: 0000074
2025-05-13 14:20 matt Note Added: 0000107
2025-05-13 15:30 matt Note Added: 0000108
2025-05-13 15:47 matt Note Added: 0000109
2025-05-13 19:30 DoubleBastionAdmin Note Added: 0000110