Re: [Tiki-devel] Issues with File Galleries in Tiki 27

Karsten Wemheuer via TikiWiki-devel <[email protected]> Tue, 19 May 2026 11:31:13 +0200
Newsgroups gmane.comp.cms.tiki.devel
Message-ID <[email protected]>
--=-T7P7wMJ7OjDmWCwQvbdd
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi,

I found a solution for my problem. The reason is that in
`fileContentIsSVG`, the data is passed by reference. If the `gzdecode`
function then returns `false`, the reference is destroyed.

The attached patch passes the data by value, thereby avoiding the
problem.

The patch is for Tiki 27.5 and will likely work in more recent versions
as well.

HTH,

Have a nice day!

Best regards

Karsten

Am Dienstag, dem 19.05.2026 um 07:33 +0200 schrieb Bernard Sfez:
> Thank you Karsten !
>=20
> Take care,
> Bernard
>=20
> > On 18 May 2026, at 20:46, Karsten Wemheuer via TikiWiki-devel
> > <[email protected]> wrote:
> >=20
> > Hi,
> >=20
> > I think I've found a bug.
> >=20
> > In the function "fileContentIsSVG(&$data)", data is passed by
> > reference. If gzdecode() returns false for some reason, the
> > reference
> > is overwritten:
> >=20
> > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (
> > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 substr($ty=
pe, 0, 18) =3D=3D 'application/x-gzip' ||
> > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 substr($ty=
pe, 0, 16) =3D=3D 'application/gzip'
> > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ) {
> > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $data =3D =
gzdecode($data);
> > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $finfo =3D=
 new finfo(FILEINFO_MIME);
> > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 $type =3D =
$finfo->buffer($data);
> > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }
> >=20
> > I'll create a patch.
> >=20
> > Have a nice evening
> >=20
> > Karsten
> >=20
> > Am Montag, dem 18.05.2026 um 13:02 +0200 schrieb Karsten Wemheuer
> > via
> > TikiWiki-devel:
> > > Thanks Bernard
> > >=20
> > > I upgraded to 27.5.=20
> > >=20
> > > Unfortunately, the bug is still present in version 27.5.=20
> > >=20
> > > I'll try to fix it. Any ideas where to start?
> > >=20
> > > Karsten
> > >=20
> > > Am Montag, dem 18.05.2026 um 06:42 +0200 schrieb Bernard Sfez:
> > > > Hi Karsten,
> > > >=20
> > > > Long time=E2=80=A6
> > > > I kindly suggest to upgrade to Tiki27.5.
> > > > Many good reasons to do it, and may be this one too. ;-)
> > > >=20
> > > > Bernard
> > > >=20
> > > > > On 17 May 2026, at 14:06, Karsten Wemheuer via TikiWiki-devel
> > > > > <[email protected]> wrote:
> > > > >=20
> > > > > Hi,
> > > > >=20
> > > > > I have a Tiki 27.3 installation here. I can't upload .gz
> > > > > files to
> > > > > the
> > > > > File Gallery. They appear as having a size of 0 and aren't
> > > > > saved
> > > > > to
> > > > > the
> > > > > hard drive (no path and no hash in the database).
> > > > >=20
> > > > > The installation was previously running on version 27.2, and
> > > > > I
> > > > > didn't
> > > > > have these issues then.
> > > > > Where should I look to troubleshoot this problem?
> > > > >=20
> > > > > Thanks
> > > > > Karsten
> > > > >=20
> > > > >=20
> > > > > _______________________________________________
> > > > > TikiWiki-devel mailing list
> > > > > [email protected]
> > > > > https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
> > > >=20
> > >=20
> > >=20
> > >=20
> > > _______________________________________________
> > > TikiWiki-devel mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
> >=20
> >=20
> >=20
> > _______________________________________________
> > TikiWiki-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
>=20


--=-T7P7wMJ7OjDmWCwQvbdd
Content-Disposition: attachment; filename="fix-broken-gzip-upload.patch"
Content-Type: text/x-patch; name="fix-broken-gzip-upload.patch"; charset="UTF-8"
Content-Transfer-Encoding: base64

ZGlmZiAtTnVyIHRpa2ktMjcuNWEvbGliL2ZpbGVnYWxzL2ZpbGVnYWxsaWIucGhwIHRpa2ktMjcu
NWIvbGliL2ZpbGVnYWxzL2ZpbGVnYWxsaWIucGhwCi0tLSB0aWtpLTI3LjVhL2xpYi9maWxlZ2Fs
cy9maWxlZ2FsbGliLnBocAkyMDI2LTAyLTA0IDIwOjIzOjM2LjAwMDAwMDAwMCArMDEwMAorKysg
dGlraS0yNy41Yi9saWIvZmlsZWdhbHMvZmlsZWdhbGxpYi5waHAJMjAyNi0wNS0xOSAxMToxMzox
Ni45OTUzNjA3NjIgKzAyMDAKQEAgLTM2NTQsNyArMzY1NCw3IEBACiAgICAgICAgIHJldHVybiAk
dGl0bGU7CiAgICAgfQogCi0gICAgcHVibGljIGZ1bmN0aW9uIGZpbGVDb250ZW50SXNTVkcoJiRk
YXRhKQorICAgIHB1YmxpYyBmdW5jdGlvbiBmaWxlQ29udGVudElzU1ZHKCRkYXRhKQogICAgIHsK
ICAgICAgICAgJGZpbmZvID0gbmV3IGZpbmZvKEZJTEVJTkZPX01JTUUpOwogCkBAIC0zNjY0LDkg
KzM2NjQsMTEgQEAKICAgICAgICAgICAgIHN1YnN0cigkdHlwZSwgMCwgMTgpID09ICdhcHBsaWNh
dGlvbi94LWd6aXAnIHx8CiAgICAgICAgICAgICBzdWJzdHIoJHR5cGUsIDAsIDE2KSA9PSAnYXBw
bGljYXRpb24vZ3ppcCcKICAgICAgICAgKSB7Ci0gICAgICAgICAgICAkZGF0YSA9IGd6ZGVjb2Rl
KCRkYXRhKTsKLSAgICAgICAgICAgICRmaW5mbyA9IG5ldyBmaW5mbyhGSUxFSU5GT19NSU1FKTsK
LSAgICAgICAgICAgICR0eXBlID0gJGZpbmZvLT5idWZmZXIoJGRhdGEpOworICAgICAgICAgICAg
JGRlY29kZWQgPSBnemRlY29kZSgkZGF0YSk7CisgICAgICAgICAgICBpZiAoJGRlY29kZWQgIT09
IGZhbHNlKSB7CisgICAgICAgICAgICAgICAgJGZpbmZvID0gbmV3IGZpbmZvKEZJTEVJTkZPX01J
TUUpOworICAgICAgICAgICAgICAgICR0eXBlID0gJGZpbmZvLT5idWZmZXIoJGRlY29kZWQpOwor
ICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgICAgIHJldHVybiBzdWJzdHIoJHR5cGUsIDAs
IDkpID09ICdpbWFnZS9zdmcnOwogICAgIH0K


--=-T7P7wMJ7OjDmWCwQvbdd
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--=-T7P7wMJ7OjDmWCwQvbdd
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
TikiWiki-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel

--=-T7P7wMJ7OjDmWCwQvbdd--