Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93778 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99648 invoked from network); 4 Jun 2016 19:42:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jun 2016 19:42:10 -0000 Authentication-Results: pb1.pair.com header.from=j.boggiano@seld.be; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=j.boggiano@seld.be; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain seld.be designates 74.125.82.50 as permitted sender) X-PHP-List-Original-Sender: j.boggiano@seld.be X-Host-Fingerprint: 74.125.82.50 mail-wm0-f50.google.com Received: from [74.125.82.50] ([74.125.82.50:37921] helo=mail-wm0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 06/2A-25194-01F23575 for ; Sat, 04 Jun 2016 15:42:09 -0400 Received: by mail-wm0-f50.google.com with SMTP id m124so26636343wme.1 for ; Sat, 04 Jun 2016 12:42:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seld-be.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=XZqNzS+/+pxrGI3c/PPmVobZ3ESQ528ipQbB2l6Diq8=; b=rgZZYYdKHW7TSsL6uC9Rh265g0sm3fSE6cH7b4I/rYaUQ1KkDWC/DtBWx8MsH2Zzje DwhhT7Z7E+KoY78K+NY+RxGaRjpQ/XLVUkS/8KeuTUZZxlV7jM5AAcBhJ9B9+tExfuyV JPPv+R/qzidJykjvkTL8U/k/UYOzgVcMUAdz1KZGnOP2+XojKzKNL/T/uFOMl0JH66X9 UQ8HE7ZYBdKmYAfduV/ZwDt3xVScq9LzWiTbUtnfknaNFiCVxJVA9ucrimu4LBUNYrQS Lr/FeCf2FGnBnElKm1fEf11wy1nU+S2hYMSnPgIvu74n6pOBOTuQ9ueW8DacYG2+pxpA ++Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=XZqNzS+/+pxrGI3c/PPmVobZ3ESQ528ipQbB2l6Diq8=; b=lTc+ztuLfvcE0PjUhf/ljSQUK7KkDkS9jJyU0Ve0Kd3FbFnFcnG8SedRB3y0pJx16a L5E4ioUCwvKdWc/LmhbVj6o8GiBWyJuo9VtHki12tz3Rp6ZJL08JNMPpPiFZs5LySAlW abXnOZFXNlhfNEcREqcuMS45HAM3O+QhEovMGyEKSJ/y5OVdGJYusUxrcN4qGmIa1CjL 6PXHgwS/fO5KwQNxWkTfRTg/OXJIkld8wrBjYAGrSmgePoZXZ+DmZ+h2ysjFDxkvvW+5 Q2N1pBxhkWl7mpuZLWlrtaJJHKhXDxK83W/ukHJ5c3qebrYOSzhHTA5Q534yadyKBoJh xWmQ== X-Gm-Message-State: ALyK8tJAFvQWmgJ9Fu/MwrBv94LsdVXW0ysRuslqQBXFFQXQxXRhOoUyCk8aqy8fCJSidg== X-Received: by 10.28.93.142 with SMTP id r136mr1695412wmb.70.1465069325861; Sat, 04 Jun 2016 12:42:05 -0700 (PDT) Received: from [192.168.0.2] (cpc74585-lewi13-2-0-cust978.2-4.cable.virginm.net. [82.25.75.211]) by smtp.googlemail.com with ESMTPSA id a195sm5940518wma.2.2016.06.04.12.42.04 for (version=TLSv1/SSLv3 cipher=OTHER); Sat, 04 Jun 2016 12:42:04 -0700 (PDT) To: internals@lists.php.net References: Message-ID: Date: Sat, 4 Jun 2016 20:42:07 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] can't reflection on DateTime properties? From: j.boggiano@seld.be (Jordi Boggiano) On 04/06/2016 20:36, Rasmus Schultz wrote: > I wrote a library that can serialize/unserialize PHP object graphs to JSON > data. > > Somebody reported it doesn't work on the DateTime class. > > Does this deliberately not work? > > $date = new DateTime(); > > var_dump($date); > > outputs: > > object(DateTime)#1 (3) { > ["date"]=> > string(19) "2016-06-04 19:30:19" > ["timezone_type"]=> > int(3) > ["timezone"]=> > string(3) "UTC" > } > > however, this... > > $reflection = new ReflectionClass('DateTime'); > > var_dump($reflection->getProperties()); > > outputs: > > array(0) { > } > > The object clearly has properties corresponding to it's internal state, but > reflection doesn't seem to report them? I can't tell you why it acts like this, but in case you are looking for a workaround: https://3v4l.org/V5cfl Cheers -- Jordi Boggiano @seldaek - http://seld.be