Date: Tue, 1 Mar 2022 21:22:09 +0000 From: Waitman Gobble <gobble.wa@gmail.com> To: 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: <CAFuo_fxTRSs7WQ7cSybPjMtHCmQQpqn=pi2i6xvEr2UnvFt2iQ@mail.gmail.com> In-Reply-To: <1894256119.63523696.1646164551088.JavaMail.zimbra@shaw.ca> References: <637715396.61990484.1646149769165.JavaMail.zimbra@shaw.ca> <CAFuo_fzAyeDBvr0UbjJUqQii1ygePUMY-7FM93vCZZYb2S40DQ@mail.gmail.com> <CAFuo_fxjM5Dsy4DGgJtZwneW9SgZM8dHt8uX3KivWKxdgRdCxw@mail.gmail.com> <1894256119.63523696.1646164551088.JavaMail.zimbra@shaw.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 1, 2022 at 7:55 PM Dale Scott <dalescott@shaw.ca> wrote: > > ----- 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 php= 8 diff FreeBSD vs Debian) > > > On Tue, Mar 1, 2022 at 4:45 PM Waitman Gobble <gobble.wa@gmail.com> wro= te: > >> > >> 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 a= nything > >> > beyond following the installation instructions? > >> > > ... > >> > Fwiw, here is the PHP Fatal error that occurs after saving a profile= picture (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():= Argument > >> > #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/SugarControlle= r.php(1017): > >> > require_once('...')\n#2 > >> > /usr/local/www/SuiteCRM-7.12.4/include/MVC/Controller/SugarControlle= r.php(465): > >> > SugarController->handleEntryPoint()\n#3 > >> > /usr/local/www/SuiteCRM-7.12.4/include/MVC/Controller/SugarControlle= r.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.= php(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=3DDet= ailView&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'], tru= e)) { > >> > $showPreview =3D isset($_REQUEST['preview']) && $_REQUEST['previ= ew'] =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 co= de. > >> 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= my profile record in the database "users" table, but curiously the file is= renamed when stored (stored as ".../upload/1_photo"), and I haven't found = an index table giving the relationship between the original filename and th= e stored filename. > > However, I see essentially the same PHP Fatal error after uploading a PDF= file using the "Documents" feature, but in this case the record in the "do= cuments" table contains both the original filename ("document_name" field) = and the stored filename ("document_revision_id" field). > > So maybe there are two errors, but assuming SuiteCRM works on Linux, then= FreeBSD is still the common cause (or rather Apache/MariaDb/PHP8 on FreeBS= D is), then I'm at a loss understanding what that could be. However, with a= bit 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= .103.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/= SuiteCRM-7.12.4/modules/Documents/Document.php(269): in_array()\n#1 /usr/lo= cal/www/SuiteCRM-7.12.4/modules/Documents/Document.php(227): Document->fill= _in_additional_detail_fields()\n#2 /usr/local/www/SuiteCRM-7.12.4/data/Suga= rBean.php(6183): Document->fill_in_additional_list_fields()\n#3 /usr/local/= www/SuiteCRM-7.12.4/include/ListView/ListViewData.php(435): SugarBean->load= FromRow()\n#4 /usr/local/www/SuiteCRM-7.12.4/include/ListView/ListViewDispl= ay.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):= ViewList->listViewProcess()\n#7 /usr/local/www/SuiteCRM-7.12.4/include/MVC= /View/SugarView.php(210): ViewList->display()\n#8 /usr/local/www/SuiteCRM-7= .12.4/include/MVC/Controller/SugarController.php(432): SugarView->process()= \n#9 /usr/local/www/SuiteCRM-7.12.4/include/MVC/Controller/SugarController.= php(363): SugarController->processView()\n#10 /usr/local/www/SuiteCRM-7.12.= 4/include/MVC/SugarApplication.php(101): SugarController->execute()\n#11 /u= sr/local/www/SuiteCRM-7.12.4/index.php(52): SugarApplication->execute()\n#1= 2 {main}\n thrown in /usr/local/www/SuiteCRM-7.12.4/modules/Documents/Docu= ment.php on line 269, referer: https://suitecrm.dalescott.net/index.php?mod= ule=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; I took a look at the git repo, i had needle and haystack switched around, haystack is 2nd param in in_array. (some php functions have haystack first, i guess it depended on what the weather was outside) $sugar_config['allowed_preview'] is set in include/utils.php - what do you have it set to in that file? it's only used (read) twice, once in download.php and again in your error file, modeuls/Documents/Document.php If it "runs on Linux" i put my money that php7 is running on the Linux that works. php 8 is much more picky, php 7 wouldn't cause a type error from that code. --=20 Waitman Gobble
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFuo_fxTRSs7WQ7cSybPjMtHCmQQpqn=pi2i6xvEr2UnvFt2iQ>