Re: HTTP_ACCEPT_LANGUAGE

Moritz Bunkus <[email protected]> Sat, 14 Feb 2004 12:38:43 +0100
Newsgroups gmane.comp.bug-tracking.anthill.devel
Message-ID <[email protected]>
--===============42915744642940301==
Content-Disposition: inline
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="9jHkwA2TBA/ec6v+"


--9jHkwA2TBA/ec6v+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Heya,

> That is a notice not a warning.  PHP has several error reporting levels,
> E_NOTICE reporting should not be used in production environments.
>=20
> >From the php manual ( see
> http://www.php.net/manual/en/ref.errorfunc.php#ini.error-reporting ):
> " In PHP 4 and PHP 5 the default value is E_ALL & ~E_NOTICE. This
> setting does not show E_NOTICE level errors. You may want to show them
> during development."

I see. (No, I'm not a PHP developper, obviously ;))

> A way of avoiding this is to change the offending line to:
>  if (@$_SERVER['HTTP_ACCEPT_LANGUAGE'])
>=20
> The "@" supressed the "error", but placing @s everywhere can hinder the
> finding of real bugs when hunting for them.  This is part of the reason
> why the default error reporting level in PHP is E_ALL & ~E_NOTICE

I'm not suggesting to put a @ everywhere, but I don't want to unset
E_NOTICE either because it has saved my butt during the upgrade to
0.3.0: I kept my old config.inc.php, but it didn't contain
$_conf['crlf'], so the mails sent didn't contain ANY new lines
in the headers whatsoever. Funny result :) PHP printed out a couple of
notices, though, and I fixed that easily.

The warning levels are from the standard Debian PHP installation, and I
don't quite agree that E_NOTICE shouldn't be set on production
systems. The PHP apps I use here (phpmyadmin, phppgadmin) don't emit a
single of those, probably because they're programmed sensibly. Anthill
is programmed sensibly as well - it's just this one case where it
assumes that a hash key exists that actually doesn't. Like I've written,
a simple isset() around it solves that very nicely. It's definitely OK
to just access $_conf['whatever'] because the program can assume that
(for a normal installation) this key really exists. But the environment
variables the server/PHP binary sets are subject to change/not under the
control of the Anthill installation and should be checked.

Mosu

--=20
If Darl McBride was in charge, he'd probably make marriage
unconstitutional too, since clearly it de-emphasizes the commercial
nature of normal human interaction, and probably is a major impediment
to the commercial growth of prostitution. - Linus Torvalds

--9jHkwA2TBA/ec6v+
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFALgjDTJ9OsraNuaERAixPAJ9j8pguUOzRLWRUvP7SGVIkTvdmUQCgl3ln
py7eRyzAJ5gRWByZHG4+2N8=
=dRVu
-----END PGP SIGNATURE-----

--9jHkwA2TBA/ec6v+--


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

_______________________________________________
Anthill-workers mailing list
Anthill-workers-+mQDA36h6dWw5LPnMra/[email protected]
http://vmlinuz.ca/mailman/listinfo/anthill-workers

--===============42915744642940301==--