Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93785 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12546 invoked from network); 4 Jun 2016 21:11:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jun 2016 21:11:18 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.82 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.82 mx101.easyname.com Received: from [77.244.243.82] ([77.244.243.82:34383] helo=mx205.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 88/9C-25194-3F343575 for ; Sat, 04 Jun 2016 17:11:17 -0400 Received: from cable-81-173-133-15.netcologne.de ([81.173.133.15] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1b9Iqd-0001VZ-VQ; Sat, 04 Jun 2016 21:11:12 +0000 Reply-To: internals@lists.php.net References: <801c8df4-4f33-935b-5bee-ff73a0865433@gmail.com> To: Rasmus Schultz , Stanislav Malyshev Cc: PHP internals Message-ID: <801210b7-e9d2-3f5f-ce00-90616010c820@fleshgrinder.com> Date: Sat, 4 Jun 2016 23:10:47 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pGtuqPUmU6FX4FoH7NKPgCiAEJP3QBLl3" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] can't reflection on DateTime properties? From: php@fleshgrinder.com (Fleshgrinder) --pGtuqPUmU6FX4FoH7NKPgCiAEJP3QBLl3 Content-Type: multipart/mixed; boundary="DGskdUhEEq5187ggGCgpxLXGOkV1qKwcE" From: Fleshgrinder Reply-To: internals@lists.php.net To: Rasmus Schultz , Stanislav Malyshev Cc: PHP internals Message-ID: <801210b7-e9d2-3f5f-ce00-90616010c820@fleshgrinder.com> Subject: Re: [PHP-DEV] can't reflection on DateTime properties? References: <801c8df4-4f33-935b-5bee-ff73a0865433@gmail.com> In-Reply-To: --DGskdUhEEq5187ggGCgpxLXGOkV1qKwcE Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 6/4/2016 11:05 PM, Rasmus Schultz wrote: > I know that things like internal state and read-only properties are > possible for classes written in C, but those features aren't possible i= n > PHP code - classes that behave this way are inconsistent with classes > written in the language, and it becomes a problem in cases such as this= =2E >=20 > That is no help at all, when you're implementing a JSON serializer. >=20 > You can see the class in question here: >=20 > https://github.com/mindplay-dk/jsonfreeze/blob/master/mindplay/jsonfree= ze/JsonSerializer.php >=20 > Because DateTime does not behave like other classes, the only work-arou= nd > is to explicitly handle DateTime with an if/instanceof-statement and ha= ndle > that particular class explicitly. >=20 > There are plenty of work-arounds - the point is that this class doesn't= > behave consistently with any other PHP class. >=20 I have to fully agree with Rasmus here. This is one of those unnecessary WTF moments for users that forces them to implement work arounds instead of simply writing good software. --=20 Richard "Fleshgrinder" Fussenegger --DGskdUhEEq5187ggGCgpxLXGOkV1qKwcE-- --pGtuqPUmU6FX4FoH7NKPgCiAEJP3QBLl3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXU0PeAAoJEOKkKcqFPVVrT38P/AgDI/5R8sgiTtLOsmDnCFCn WPu/zmHyLYBgv98faA26DwTktP9bx6ZW+1zm3WA/7xaXaa9hZPbFPTHl447Lirbx EIAgGhdxSrqGi4gDg3T2JSP6jTr5cIvR4ekJvJsrZ1TSxd/P9L6TSneXBvYN6yfO A12BqUVmxr/5P+83rHMb4whtGa6K5MLQyfVtStCgs0/0GrmJL0ii/D8J1li8Lc17 jSlXNrzsD3O31dVPjO0PXlRveda4ow5K8/qc3fVFwo++FAyZpe22/agxpzgqhVa4 zeZ7omrc5xA1KDw4gZd3LamGra/k5Chg/d/rv9DBKI24Rqk9g/3AfyTPG2pMf94A FVwJMu0Rw0bt0jqRo4g7D+ciXMCZlqfAvu6CL7eEK7BZxIWIxvAitPwHqmp8QhSF AnzcEWsobRuXtQ+D3K2PRJ2bMvlR7gqEJI1ENWUbCVP16zMP6FbFZN6YtGlnwVp5 ZxgPcVnadTF9aU4nTFMJIr5lSOb3T/7kAIttxj8/xr8dIyxJLHekEIG+o2L5DKg+ WTxF7X7plaRuYJ6xO6fGMuXNeeiFzMcFgTvgGsoXiaHe1fJ540t9tPxs/w7H7RA+ vrHlp3u8tvSwfxyN42uy+066h1qWilj+ugcdBXgKw3kvAxejYpmL0QjKKUnu6oFm xQ+YQfOjJz1BITULRpYF =AfWc -----END PGP SIGNATURE----- --pGtuqPUmU6FX4FoH7NKPgCiAEJP3QBLl3--