Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Mar 2022 12:55:51 -0700 (MST)
From:      Dale Scott <dalescott@shaw.ca>
To:        Waitman Gobble <gobble.wa@gmail.com>
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: file upload issues with SuiteCRM V7/8 (or apache24 and php8 diff FreeBSD vs Debian)
Message-ID:  <1894256119.63523696.1646164551088.JavaMail.zimbra@shaw.ca>
In-Reply-To: <CAFuo_fxjM5Dsy4DGgJtZwneW9SgZM8dHt8uX3KivWKxdgRdCxw@mail.gmail.com>
References:  <637715396.61990484.1646149769165.JavaMail.zimbra@shaw.ca> <CAFuo_fzAyeDBvr0UbjJUqQii1ygePUMY-7FM93vCZZYb2S40DQ@mail.gmail.com> <CAFuo_fxjM5Dsy4DGgJtZwneW9SgZM8dHt8uX3KivWKxdgRdCxw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
----- Original Message -----
> From: "Waitman Gobble" <gobble.wa@gmail.com>
> To: "freebsd-questions" <freebsd-questions@freebsd.org>
> Sent: Tuesday, March 1, 2022 9:47:05 AM
> Subject: Re: file upload issues with SuiteCRM V7/8 (or apache24 and php8 =
diff FreeBSD vs Debian)

> On Tue, Mar 1, 2022 at 4:45 PM Waitman Gobble <gobble.wa@gmail.com> wrote=
:
>>
>> On Tue, Mar 1, 2022 at 3:50 PM Dale Scott <dalescott@shaw.ca> wrote:
>> >
>> > Is anyone using SuiteCRM on FreeBSD, and if so, did you have to do any=
thing
>> > beyond following the installation instructions?
>> >
...
>> > Fwiw, here is the PHP Fatal error that occurs after saving a profile p=
icture (I
>> > presume when the page is rendered with the new image):
>> >
>> > [Tue Mar 01 08:13:13.132076 2022] [php:error] [pid 49638] [client
>> > 174.0.43.39:45460] PHP Fatal error:  Uncaught TypeError: in_array(): A=
rgument
>> > #2 ($haystack) must be of type array, null given in
>> > /usr/local/www/SuiteCRM-7.12.4/download.php:267\nStack trace:\n#0
>> > /usr/local/www/SuiteCRM-7.12.4/download.php(267): in_array()\n#1
>> > /usr/local/www/SuiteCRM-7.12.4/include/MVC/Controller/SugarController.=
php(1017):
>> > require_once('...')\n#2
>> > /usr/local/www/SuiteCRM-7.12.4/include/MVC/Controller/SugarController.=
php(465):
>> > SugarController->handleEntryPoint()\n#3
>> > /usr/local/www/SuiteCRM-7.12.4/include/MVC/Controller/SugarController.=
php(361):
>> > SugarController->process()\n#4
>> > /usr/local/www/SuiteCRM-7.12.4/include/MVC/SugarApplication.php(101):
>> > SugarController->execute()\n#5 /usr/local/www/SuiteCRM-7.12.4/index.ph=
p(52):
>> > SugarApplication->execute()\n#6 {main}\n  thrown in
>> > /usr/local/www/SuiteCRM-7.12.4/download.php on line 267, referer:
>> > https://suitecrm.dalescott.net/index.php?module=3DUsers&action=3DDetai=
lView&record=3D1
>> > dale@whizzer:/usr/local/etc/php %
>> >
>> > and this is the offending line 267 in download.php
>> >
>> > if (in_array($row['file_ext'], $sugar_config['allowed_preview'], true)=
) {
>> >     $showPreview =3D isset($_REQUEST['preview']) && $_REQUEST['preview=
'] =3D=3D=3D 'yes' &&
>> >     $mime_type !=3D=3D 'text/html';
>> > }
>> >
...
>>
>> There's no result from (i presume) db query .
>>
>> $row['file_ext'] is null.
>>
>> $row is typically used for a db result, but i haven't looked at the code=
.
>> Code execution probably should make it to this block if there's no
>> query result.
>>
>> I'll check out SugarCRM I don't think i've tried this one.
>>
> --
> Waitman Gobble

Thanks Waitman. The original filename for my profile picture is stored in m=
y profile record in the database "users" table, but curiously the file is r=
enamed when stored (stored as ".../upload/1_photo"), and I haven't found an=
 index table giving the relationship between the original filename and the =
stored filename.

However, I see essentially the same PHP Fatal error after uploading a PDF f=
ile using the "Documents" feature, but in this case the record in the "docu=
ments" table contains both the original filename ("document_name" field) an=
d the stored filename ("document_revision_id" field).

So maybe there are two errors, but assuming SuiteCRM works on Linux, then F=
reeBSD is still the common cause (or rather Apache/MariaDb/PHP8 on FreeBSD =
is), then I'm at a loss understanding what that could be. However, with a b=
it more information I'll try posting to the SuiteCRM forum.

PHP Fatal error accessing Documents after uploading PDF file:

[Tue Mar 01 11:29:51.595046 2022] [php:error] [pid 50591] [client 162.223.1=
03.50:11593] PHP Fatal error:  Uncaught TypeError: in_array(): Argument #2 =
($haystack) must be of type array, null given in /usr/local/www/SuiteCRM-7.=
12.4/modules/Documents/Document.php:269\nStack trace:\n#0 /usr/local/www/Su=
iteCRM-7.12.4/modules/Documents/Document.php(269): in_array()\n#1 /usr/loca=
l/www/SuiteCRM-7.12.4/modules/Documents/Document.php(227): Document->fill_i=
n_additional_detail_fields()\n#2 /usr/local/www/SuiteCRM-7.12.4/data/SugarB=
ean.php(6183): Document->fill_in_additional_list_fields()\n#3 /usr/local/ww=
w/SuiteCRM-7.12.4/include/ListView/ListViewData.php(435): SugarBean->loadFr=
omRow()\n#4 /usr/local/www/SuiteCRM-7.12.4/include/ListView/ListViewDisplay=
.php(158): ListViewData->getListViewData()\n#5 /usr/local/www/SuiteCRM-7.12=
.4/include/MVC/View/views/view.list.php(283): ListViewDisplay->setup()\n#6 =
/usr/local/www/SuiteCRM-7.12.4/include/MVC/View/views/view.list.php(391): V=
iewList->listViewProcess()\n#7 /usr/local/www/SuiteCRM-7.12.4/include/MVC/V=
iew/SugarView.php(210): ViewList->display()\n#8 /usr/local/www/SuiteCRM-7.1=
2.4/include/MVC/Controller/SugarController.php(432): SugarView->process()\n=
#9 /usr/local/www/SuiteCRM-7.12.4/include/MVC/Controller/SugarController.ph=
p(363): SugarController->processView()\n#10 /usr/local/www/SuiteCRM-7.12.4/=
include/MVC/SugarApplication.php(101): SugarController->execute()\n#11 /usr=
/local/www/SuiteCRM-7.12.4/index.php(52): SugarApplication->execute()\n#12 =
{main}\n  thrown in /usr/local/www/SuiteCRM-7.12.4/modules/Documents/Docume=
nt.php on line 269, referer: https://suitecrm.dalescott.net/index.php?modul=
e=3DUsers&action=3DEditView&record=3D1
dale@whizzer:~ %

Offending line 269 from document.php

if (in_array($row['file_ext'], $sugar_config['allowed_preview'])) {
    $this->show_preview =3D true;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1894256119.63523696.1646164551088.JavaMail.zimbra>