# [VOTE] Deprecate dynamic properties

- Thread: https://staging.externals.io/message/116325
- Original archive: https://news-web.php.net/php.internals/116325
- Started by Nikita Popov on 2021-11-12T13:07:42+00:00
- Messages: 39
- RFC: Deprecate dynamic properties (Implemented (PHP 8.2)) — https://staging.externals.io/rfc/deprecate_dynamic_properties.md
- Page 1 of 2: messages 1 to 25 (25 per page, add `?page=N` to the URL)
- Next page: https://staging.externals.io/message/116325.md?page=2
- Reply by email to internals@lists.php.net
- More for agents: search with https://staging.externals.io/search.md?q={query} · RFCs at https://staging.externals.io/rfc.md · JSON API at https://staging.externals.io/api · documentation at https://staging.externals.io/llms.txt

---

## #116325 — Nikita Popov — 2021-11-12T13:07:42+00:00

URL: https://staging.externals.io/message/116325#116325

Hi internals,

I've opened the vote on
https://wiki.php.net/rfc/deprecate_dynamic_properties. Voting will close
2021-11-26.

Regards,
Nikita

---

## #116326 — Derick Rethans — 2021-11-12T16:10:13+00:00

URL: https://staging.externals.io/message/116325#116326 · In reply to: #116325

>Hi internals,
>
>I've opened the vote on
>https://wiki.php.net/rfc/deprecate_dynamic_properties. Voting will close
>2021-11-26.

I've voted no on this one. Not because I don't like the idea, but because I think the timeline for deprecation and removal is way too fast. 

This is IMO not something important enough to cause a fairly large BC break for, and it should wait until the last in the 8.x series before we deprecate it. 

cheers 
Derick

---

## #116327 — Ben Ramsey — 2021-11-12T16:24:45+00:00

URL: https://staging.externals.io/message/116325#116327 · In reply to: #116326

> 
> 
> 
> > […]
> 
> I've voted no on this one. Not because I don't like the idea, but because I think the timeline for deprecation and removal is way too fast.
> 
> This is IMO not something important enough to cause a fairly large BC break for, and it should wait until the last in the 8.x series before we deprecate it.
> 
> cheers
> Derick


I’ve voted no for the same reason.

I like this change, but the deprecation in 8.2 seems too disruptive. I’d
rather promote our intent to deprecate this with a statement in the
manual that says something like, “This feature will be deprecated in
PHP 8.3 and removed in 9.0.” Meanwhile, 8.2 should include the
AllowDynamicProperties attribute so folks can start preparing.

Cheers,
Ben

---

## #116328 — Nikita Popov — 2021-11-12T16:34:10+00:00

URL: https://staging.externals.io/message/116325#116328 · In reply to: #116327

> > […]
> wrote:
> > […]
> close
> > […]
> because I think the timeline for deprecation and removal is way too fast.
> > […]
> break for, and it should wait until the last in the 8.x series before we
> deprecate it.
> > […]
>
>
> I’ve voted no for the same reason.
>
> I like this change, but the deprecation in 8.2 seems too disruptive. I’d
> rather promote our intent to deprecate this with a statement in the
> manual that says something like, “This feature will be deprecated in
> PHP 8.3 and removed in 9.0.”


FWIW I think we should always deprecate things as soon as possible, to give
people the maximum amount of awareness and time to address the issue before
the actual removal occurs. Most people will not be aware they need to take
action if it's just a note in the manual. For that reason, I find it
generally preferable to deprecate something closer to PHP 8.0 than to 8.4,
which would be directly before a major version with limited time to act.
Now, we don't usually tend to optimize for "time of deprecation" because
that requires planning deprecations many years in advance, but if the
choice existed I'd always go for deprecating early in the major release
cycle, rather than late.


> Meanwhile, 8.2 should include the
> AllowDynamicProperties attribute so folks can start preparing.
>

Given how attributes in PHP work, this doesn't make sense to me. You can
already use #[AllowDynamicProperties] in your code right now, without any
special support from PHP. Only static analyzers / IDEs need to know that
they shouldn't complain about it even on versions where it does not
technically exist.

Regards,
Nikita

---

## #116329 — Christoph M. Becker — 2021-11-12T16:44:39+00:00

URL: https://staging.externals.io/message/116325#116329 · In reply to: #116327

> > […]
>
> I’ve voted no for the same reason.
>
> I like this change, but the deprecation in 8.2 seems too disruptive. I’d
> rather promote our intent to deprecate this with a statement in the
> manual that says something like, “This feature will be deprecated in
> PHP 8.3 and removed in 9.0.” Meanwhile, 8.2 should include the
> AllowDynamicProperties attribute so folks can start preparing.

Didn't we do this for ext/mysql?  Had that the desired effect?  I don't
think so.  Unfortunately, too many devs don't read the docs, and why
would they, if they now how stuff works.

--
Christoph M. Becker

---

## #116330 — Nikita Popov — 2021-11-12T16:56:22+00:00

URL: https://staging.externals.io/message/116325#116330 · In reply to: #116328

> 
>
> > […]
>
>
> FWIW I think we should always deprecate things as soon as possible, to
> give people the maximum amount of awareness and time to address the issue
> before the actual removal occurs. Most people will not be aware they need
> to take action if it's just a note in the manual. For that reason, I find
> it generally preferable to deprecate something closer to PHP 8.0 than to
> 8.4, which would be directly before a major version with limited time to
> act. Now, we don't usually tend to optimize for "time of deprecation"
> because that requires planning deprecations many years in advance, but if
> the choice existed I'd always go for deprecating early in the major release
> cycle, rather than late.
>

Another thing I want to add here is that in this instance, I think that the
deprecation warning is really helpful for updating your code. It tells you
exactly which property on which class is being created dynamically, so you
can quickly go through these and add missing property declarations or
#[AllowDynamicProperties] attributes. Without the deprecation warning in
place, you need a static analyzer to find problematic cases. And of course,
that only works well if you already have a fully typed code base that is
reasonably clean under static analysis. At the same time, this change is
most likely to affect projects where this is not the case. If you are
already using a static analyzer, you probably don't use dynamic properties
anyway, as these things tend to be incompatible.

Regards,
Nikita

---

## #116331 — Larry Garfield — 2021-11-12T17:43:49+00:00

URL: https://staging.externals.io/message/116325#116331 · In reply to: #116330

> 
>
> > […]
>
> Another thing I want to add here is that in this instance, I think that the
> deprecation warning is really helpful for updating your code. It tells you
> exactly which property on which class is being created dynamically, so you
> can quickly go through these and add missing property declarations or
> #[AllowDynamicProperties] attributes. Without the deprecation warning in
> place, you need a static analyzer to find problematic cases. And of course,
> that only works well if you already have a fully typed code base that is
> reasonably clean under static analysis. At the same time, this change is
> most likely to affect projects where this is not the case. If you are
> already using a static analyzer, you probably don't use dynamic properties
> anyway, as these things tend to be incompatible.
>
> Regards,
> Nikita

Also a reminder that deprecations are not errors; PHPUnit very recently changed to not complain about deprecations by default.  And anyone running with deprecations on in production is doing it wrong and will get bitten whenever the deprecation is enabled.

I have to agree with Nikita here.  Give people as much deprecation time as possible; if people are misunderstanding deprecations and abusing them, that's... a different problem that cannot be solved by not issuing deprecations.

--Larry Garfield

---

## #116332 — Chase Peeler — 2021-11-12T17:47:17+00:00

URL: https://staging.externals.io/message/116325#116332 · In reply to: #116331

On Fri, Nov 12, 2021 at 12:44 PM Larry Garfield <larry@garfieldtech.com>
wrote:

> 
> > […]
> wrote:
> > […]
> fast.
> > […]
> we
> > […]
> I’d
> > […]
> issue
> > […]
> need
> > […]
> find
> > […]
> if
> > […]
> release
> > […]
> the
> > […]
> you
> > […]
> you
> > […]
> course,
> > […]
> properties
> > […]
>
> Also a reminder that deprecations are not errors; PHPUnit very recently
> changed to not complain about deprecations by default.  And anyone running
> with deprecations on in production is doing it wrong and will get bitten
> whenever the deprecation is enabled.
>
> I have to agree with Nikita here.  Give people as much deprecation time as
> possible; if people are misunderstanding deprecations and abusing them,
> that's... a different problem that cannot be solved by not issuing
> deprecations.
>
> --Larry Garfield
>
> --
> 
> To unsubscribe, visit: https://www.php.net/unsub.php
>
>
I don't think this should be deprecated or removed at all. However, I agree
that if it is going to be removed, the more time/versions that exists
between deprecation and removal, the better.
-- 
Chase Peeler
chasepeeler@gmail.com

---

## #116333 — Deleu — 2021-11-12T17:53:28+00:00

URL: https://staging.externals.io/message/116325#116333 · In reply to: #116332

> On Fri, Nov 12, 2021 at 12:44 PM Larry Garfield <larry@garfieldtech.com>
> wrote:
>
> > […]
> nikita.ppv@gmail.com
> > […]
> will
> > […]
> BC
> > […]
> to
> > […]
> to
> > […]
> in
> > […]
> is
> > […]
> is
> > […]
> running
> > […]
> as
> > […]
> I don't think this should be deprecated or removed at all. However, I agree
> that if it is going to be removed, the more time/versions that exists
> between deprecation and removal, the better.
> --
> Chase Peeler
> chasepeeler@gmail.com
>


I agree with previous replies and would even go as further to say that it
is better to try and avoid deprecation on the last version of a PHP Series.
I like this deprecation, but I also think it's a pretty big deprecation to
happen only 1 year before it's actual removal. Deprecating it now means
people will have at least 3 years to adjust to it. Recently Laravel also
made the same changes that PHPUnit did to stop converting deprecations into
fatal errors so that users can still use deprecated code if they need more
time to accommodate.

-- 
Marco Aurélio Deleu

---

## #116334 — Matthew Weier O'Phinney — 2021-11-12T18:59:42+00:00

URL: https://staging.externals.io/message/116325#116334 · In reply to: #116325

I recognize it's a bit late to be commenting, now that voting has
started... but this feels like a solution for which we already have
workable solutions, and which will instead lead to a lot of
misunderstanding and breakage in the user ecosystem.

Our IDEs, coding standards, and static analysis tools can already flag
these things for us, helping us catch them early. Hell, unit testing will
find these for us, when a test fails due to a value not being set in a
property that we expected.

Making this fundamental change to the language means, however, that a lot
of things that we were previously able to do that "just worked" now raise a
deprecation notice, and, later, a compilation error... unless we make a
change to our already working, fully functional code.

I think the Locked Classes approach made far more sense here, because it
didn't require changes to _working_ code. By making the behavior opt-in,
developers get to choose if that's what they want for their classes,
instead of having a backwards breaking change thrust on them.

(Perhaps an even better solution would be a declaration, like we have for
strict_types, which we could do per file.)

Or maybe I'm missing something else: was there something at the engine
level that was driving this, a significant performance gain we get from
changing the behavior? Because if there was, there was no discussion of it.
In fact, the only discussion of "why" in the RFC is "In modern code, this
is rarely done intentionally". Why is that justification for changing the
behavior? Can you quantify how much code would be affected by this change?
and how much would benefit?

Yes, I know that code I write would benefit from it, and personally I'd
love to have a way to opt-in to something more strict - but I think a
switch like this is going to make upgrading to version 9 difficult if not
impossible for a huge number of PHP users.

Sweeping changes like this need data behind them. If there's such data for
this RFC, it's not present in the proposal, and as such, I cannot
understand what drives it.



> Hi internals,
>
> I've opened the vote on
> https://wiki.php.net/rfc/deprecate_dynamic_properties. Voting will close
> 2021-11-26.
>
> Regards,
> Nikita
>


-- 
Matthew Weier O'Phinney
mweierophinney@gmail.com
https://mwop.net/
he/him

---

## #116335 — Larry Garfield — 2021-11-12T21:41:25+00:00

URL: https://staging.externals.io/message/116325#116335 · In reply to: #116334

> I recognize it's a bit late to be commenting, now that voting has
> started... but this feels like a solution for which we already have
> workable solutions, and which will instead lead to a lot of
> misunderstanding and breakage in the user ecosystem.
>
> Our IDEs, coding standards, and static analysis tools can already flag
> these things for us, helping us catch them early. Hell, unit testing will
> find these for us, when a test fails due to a value not being set in a
> property that we expected.
>
> Making this fundamental change to the language means, however, that a lot
> of things that we were previously able to do that "just worked" now raise a
> deprecation notice, and, later, a compilation error... unless we make a
> change to our already working, fully functional code.
>
> I think the Locked Classes approach made far more sense here, because it
> didn't require changes to _working_ code. By making the behavior opt-in,
> developers get to choose if that's what they want for their classes,
> instead of having a backwards breaking change thrust on them.
>
> (Perhaps an even better solution would be a declaration, like we have for
> strict_types, which we could do per file.)
>
> Or maybe I'm missing something else: was there something at the engine
> level that was driving this, a significant performance gain we get from
> changing the behavior? Because if there was, there was no discussion of it.
> In fact, the only discussion of "why" in the RFC is "In modern code, this
> is rarely done intentionally". Why is that justification for changing the
> behavior? Can you quantify how much code would be affected by this change?
> and how much would benefit?
>
> Yes, I know that code I write would benefit from it, and personally I'd
> love to have a way to opt-in to something more strict - but I think a
> switch like this is going to make upgrading to version 9 difficult if not
> impossible for a huge number of PHP users.
>
> Sweeping changes like this need data behind them. If there's such data for
> this RFC, it's not present in the proposal, and as such, I cannot
> understand what drives it.

The original version of the RFC would have (as of v9) allowed for the removal of some fugly code in property handling, resulting in engine improvements and some minor performance benefits.  That was because it pushed the opt-in mechanism to "only if you extend stdclass", and stdclass would effectively have a trait with stock __get/__set implementations to handle dynamic property behavior.  (It wasn't quite that, but effectively that's what it would do.)  So that was the original impetus.

The current version doesn't actually remove the behavior yet, so it wouldn't allow for that optimization.  That does, I agree, weaken its argument, but as the RFC notes makes it easier in the future to figure out how widespread dynamic properties actually are in code today.  Right now... we simply don't know.  It's possible the impact here will be almost nil, or it could break anything written before 2010.  (I'd guess it's closer to the former than the latter, but no one knows for certain.)  Just grepping for the attribute in the future would give us a better picture of how common it is.

To those that are arguing that the timeline is too aggressive, I would turn the question around: What timeline would be acceptable?  "Well behaved" code hasn't used dynamic properties outside of a few very edge bits in a very, very long time, so transitioning to those being the exception and not the default is, IMO, reasonable.  What would be a more comfortable timeline if not what is proposed here?

(Bearing in mind the previous statements that treating deprecations as though they were warnings, even in production, is not Internals problem but a problem of people who have their servers misconfigured.)

--Larry Garfield

---

## #116336 — Matthew Weier O'Phinney — 2021-11-12T22:34:01+00:00

URL: https://staging.externals.io/message/116325#116336 · In reply to: #116335

> 
> > […]
> raise a
> > […]
> it.
> > […]
> change?
> > […]
> for
> > […]
>
> The original version of the RFC would have (as of v9) allowed for the
> removal of some fugly code in property handling, resulting in engine
> improvements and some minor performance benefits.  That was because it
> pushed the opt-in mechanism to "only if you extend stdclass", and stdclass
> would effectively have a trait with stock __get/__set implementations to
> handle dynamic property behavior.  (It wasn't quite that, but effectively
> that's what it would do.)  So that was the original impetus.
>

None of that information was in the RFC. That sort of thing really needs to
be included, as it helps a ton in justifying changes of this nature. As I
noted, on reading it, the only rationale made is a quick mention that they
lead to programming errors, and even then, there's no detail really if
_how_.


> The current version doesn't actually remove the behavior yet, so it
> wouldn't allow for that optimization.  That does, I agree, weaken its
> argument, but as the RFC notes makes it easier in the future to figure out
> how widespread dynamic properties actually are in code today.  Right now...
> we simply don't know.  It's possible the impact here will be almost nil, or
> it could break anything written before 2010.  (I'd guess it's closer to the
> former than the latter, but no one knows for certain.)  Just grepping for
> the attribute in the future would give us a better picture of how common it
> is.
>

That's the thing: it's guesswork. About a fundamental way the object model
works. While most library code may not make use of it, I can think of a
number of ways I've seen it used or used the feature myself without even
trying too hard:

- In unit tests, to create quick spies to pass into closures.
- In API wrappers, to represent payloads of specific types. (This is
particularly interesting, as it allows for these wrappers to be forward
compatible with additions to the API payload).
- As internal DTO messages, particularly when prototyping. I get the
benefits of a typed object without needing to fully define its properties.

And that's just off the top of my head.


> To those that are arguing that the timeline is too aggressive, I would
> turn the question around: What timeline would be acceptable?  "Well
> behaved" code hasn't used dynamic properties outside of a few very edge
> bits in a very, very long time, so transitioning to those being the
> exception and not the default is, IMO, reasonable.  What would be a more
> comfortable timeline if not what is proposed here?


> (Bearing in mind the previous statements that treating deprecations as
> though they were warnings, even in production, is not Internals problem but
> a problem of people who have their servers misconfigured.)
>

I'm bringing this up again: because deprecations are reported by changing a
flag to error reporting, and because the default dev configuration enables
that flag, and it's included as part of E_ALL, the reality is that many
users see the deprecations.

When those errors point to _libraries_ they consume, they report them.

Yes, library maintainers can have policies to consider errors due to
deprecations as invalid. But they still need to evaluate and review those
issues, which takes time and effort. And ignoring the issue often means it
gets reported repeatedly.

The other option is to deal with the deprecation. But this then means
yearly churn, as the project creates new deprecations with each minor
version.

Listen, I'm happy about a lot of the changes to the language as a user. But
as a library maintainer:

- Changes to fundamental, decades long behavior has huge knock-on effects
for us, and causes a lot of busy work.

- Yearly deprecations trigger an onslought of issues and patches that do
nothing for the average user, and detract from other work, such as bug
fixes and feature additions.

I'd like for a discussion on how we can allow the language to develop
without requiring yearly churn and burden on the surrounding ecosystem. And
just waving your hands and saying deprecations aren't errors is not an
answer - if it makes its way to an error log or is reported inline in a
page or in CLI output, it's an error.


> --Larry Garfield
>
> --
> 
> To unsubscribe, visit: https://www.php.net/unsub.php

---

## #116337 — Christoph M. Becker — 2021-11-13T00:13:41+00:00

URL: https://staging.externals.io/message/116325#116337 · In reply to: #116336

> 
>
> > […]
>
> None of that information was in the RFC. That sort of thing really needs to
> be included, as it helps a ton in justifying changes of this nature. As I
> noted, on reading it, the only rationale made is a quick mention that they
> lead to programming errors, and even then, there's no detail really if
> _how_.

At some point, the RFC explained some of the internal implications:
<https://wiki.php.net/rfc/deprecate_dynamic_properties?rev=1629900759#internal_impact>.
 To give one example: <https://3v4l.org/f8OZj>; no that's not a memory
leak, but rather the effects of materializing the properties HashTable.

However, since the attribute solution, which already was a compromise to
mitigate the BC break wouldn't make it possible to drop
zend_object.properties and friends, this reasoning was removed.  I still
hope that we can get rid of this ugly stuff eventually.  Obviously, that
requires to educate people and to push code bases "softly".  Offering an
opt-out of dynamic properties or some switch to disable the deprecation
would not help in that regard.

That "leading to programming errors" is about userland code.  Mistyping
the property name might not even be noticed during development/QA, but
may cause serious issues in production.  Of course, a static analyzer
would report this issue, but there is code where you'd have a hard time
to get PHPStan level 0 or Psalm level 8 working (and baseline wouldn't
catch existing issues).  Oh, and well, we're actually talking about code
which is not statically analyzed (or only at a very low level) anyway,
don't we?

> I'd like for a discussion on how we can allow the language to develop
> without requiring yearly churn and burden on the surrounding ecosystem. And
> just waving your hands and saying deprecations aren't errors is not an
> answer - if it makes its way to an error log or is reported inline in a
> page or in CLI output, it's an error.

I'd argue that it is not.  There are different levels of errors, and you
should likely treat them as such.  An error or exception is more severe
than a warning, a warning is more severe than a notice, and a
deprecation is yet different again.  You can ignore the latter, if you
don't care about the next PHP major yet; you can actually exclude them
from any kind of error reporting, until you care enough about them to
resolve them.  Even libraries could add a "suspended" ("won't fix
*now*") label to respective bug reports (and re-open when the time has
come).

Anyhow, I'm fully aware that PHP is pushing for years now.  As far as I
know, COBOL did not.

--
Christoph M. Becker

---

## #116338 — Peter Bowyer — 2021-11-13T08:26:31+00:00

URL: https://staging.externals.io/message/116325#116338 · In reply to: #116337

> Offering an
> opt-out of dynamic properties or some switch to disable the deprecation
> would not help in that regard.
>

Given this is a big change to the way PHP has behaved for decades I did
wonder why the RFC didn't propose an opt-out of dynamic properties rather
than opt-in, preserving the long-term language behaviour. So thanks for
covering that.

I think you and the PHP internals community will be surprised by how widely
used dynamic properties are. I read through a handful of WordPress plugins
we have installed and found a few. And in my own where I'm using a named
class instead of an array.

I work with modern framework based code most of the time and I find it easy
to forget what is out there as quintessential or traditional PHP code.

Whether we have #[AllowDynamicProperties] or #[DenyDynamicProperties] one
set of PHP users is going to be doing a find & replace across their
codebase.

From a DX perspective I'd rather have #[DenyDynamicProperties] as it's like
declaring strict_mode and opt-in.

Either way are the planned engine changes feasible, as the feature of
dynamic properties stays in the language but toggled off/on per class?

Peter

---

## #116340 — Victor Bolshov — 2021-11-13T11:25:58+00:00

URL: https://staging.externals.io/message/116325#116340 · In reply to: #116338

The way I see it, it might look similar to strict_types opt-in, but 
only on the surface. The amount of changes needed to make legacy code 
compliant with strict_types directive, would be tremendous, also there 
would be no simple one-size-fits-all solution like the 
#[AllowDynamicProperties]. In that sense, these two are hardly 
comparable.

I agree with the change (not that I have a voting karma, just 
watching). I also agree with Andreas Heigl saying that at certain point 
changes like this probably should happen, and regardless of exactly 
when, it is going to cause debate and complaints, but we as community 
should probably prefer having a long deprecation cycle for smoother 
transition, which is why the suggested timeline is IMO good (that is, 
if the community represented by core devs will vote for this RFC).

Opt-in strategy - #[DenyDynamicProperties] - for a change like this 
would effectively do nothing. I personally would be against this change 
at all then.

Many thanks to the PHP team from userland, also for letting anyone 
voice their thoughts and concerns on important matters!

Regards,
Victor Bolshov,
Software developer

On za, nov 13, 2021 at 08:26, Peter Bowyer <phpmailinglists@gmail.com> 
wrote:
> On Sat, 13 Nov 2021, 00:14 Christoph M. Becker, <cmbecker69@gmx.de 
> <mailto:cmbecker69@gmx.de>> wrote:
> 
> > […]
> 
> Given this is a big change to the way PHP has behaved for decades I 
> did
> wonder why the RFC didn't propose an opt-out of dynamic properties 
> rather
> than opt-in, preserving the long-term language behaviour. So thanks 
> for
> covering that.
> 
> I think you and the PHP internals community will be surprised by how 
> widely
> used dynamic properties are. I read through a handful of WordPress 
> plugins
> we have installed and found a few. And in my own where I'm using a 
> named
> class instead of an array.
> 
> I work with modern framework based code most of the time and I find 
> it easy
> to forget what is out there as quintessential or traditional PHP code.
> 
> Whether we have #[AllowDynamicProperties] or #[DenyDynamicProperties] 
> one
> set of PHP users is going to be doing a find & replace across their
> codebase.
> 
> From a DX perspective I'd rather have #[DenyDynamicProperties] as 
> it's like
> declaring strict_mode and opt-in.
> 
> Either way are the planned engine changes feasible, as the feature of
> dynamic properties stays in the language but toggled off/on per class?
> 
> Peter

---

## #116344 — Claude Pache — 2021-11-13T17:28:58+00:00

URL: https://staging.externals.io/message/116325#116344 · In reply to: #116327

> Le 12 nov. 2021 à 17:24, Ben Ramsey <ramsey@php.net> a écrit :
> 
> I like this change, but the deprecation in 8.2 seems too disruptive. I’d
> rather promote our intent to deprecate this with a statement in the
> manual that says something like, “This feature will be deprecated in
> PHP 8.3 and removed in 9.0.” Meanwhile, 8.2 should include the
> AllowDynamicProperties attribute so folks can start preparing.
> 

Kindly recalling that the intended meaning of deprecation warnings is duly documented in the manual? I have read the manual when I designed my error handler many year ago; as a consequence, this deprecation warning will not at all be disruptive for me. 

I strongly doubt that a mere statement of intention in the manual is of much utility, given that many people apparently don’t read the manual when they design their error handlers... We should rather more heavily promote the true meaning of “deprecation”.

—Claude

---

## #116345 — Pierre Joye — 2021-11-14T11:48:02+00:00

URL: https://staging.externals.io/message/116325#116345 · In reply to: #116328

Hi Nikita,



FWIW I think we should always deprecate things as soon as possible, to give
> people the maximum amount of awareness and time to address the issue before
> the actual removal occurs.


I voted no however I agree on this part, with a slight different view on
how it may be done.

> Meanwhile, 8.2 should include the
> > […]
>
> Given how attributes in PHP work, this doesn't make sense to me. You can
> already use #[AllowDynamicProperties] in your code right now, without any
> special support from PHP. Only static analyzers / IDEs need to know that
> they shouldn't complain about it even on versions where it does not
> technically exist.



I agree with other that it should be allowed by default.

Also I do see it as a kind of strict mode addition and the depreciation as
well could be strict mode only.

It could make things too complicated, so only off by default would be an
acceptable compromise to me.

best
Pierre

---

## #116346 — Rowan Tommins — 2021-11-14T16:42:14+00:00

URL: https://staging.externals.io/message/116325#116346 · In reply to: #116345

> Also I do see it as a kind of strict mode addition and the depreciation as
> well could be strict mode only.


A quick reminder that PHP has no "strict mode". It has a "strict_types" 
declaration, which is probably misnamed, and should be something like 
"scalar_types=error" vs "scalar_types=coerce".

Suggestions to add a more general "two modes for the whole language" 
approach have generally gone down in flames.

Suggestions to add other declarations tend to run into discussions of 
namespace-scoped declares / project configuration / etc

Regards,

-- 
Rowan Tommins
[IMSoP]

---

## #116353 — Pierre Joye — 2021-11-15T03:16:14+00:00

URL: https://staging.externals.io/message/116325#116353 · In reply to: #116346

On Sun, Nov 14, 2021, 11:42 PM Rowan Tommins <rowan.collins@gmail.com>
wrote:

> 
> > […]
> as
> > […]
>
>
> A quick reminder that PHP has no "strict mode". It has a "strict_types"
> declaration, which is probably misnamed, and should be something like
> "scalar_types=error" vs "scalar_types=coerce".
>
> yes, wrong word.
>

-- 
> Rowan Tommins
> [IMSoP]
>
> --
> 
> To unsubscribe, visit: https://www.php.net/unsub.php

---

## #116394 — Matthew Brown — 2021-11-15T21:40:27+00:00

URL: https://staging.externals.io/message/116325#116394 · In reply to: #116325

> Hi internals,
>
> I've opened the vote on
> https://wiki.php.net/rfc/deprecate_dynamic_properties. Voting will close
> 2021-11-26.
>
> Regards,
> Nikita
>

There are two things developers think about when releasing code:

1. does it work for me
2. does it work for everyone else

With its support for runtime type hints and other similar checks, PHP does
a reasonably good job of aligning those two — what works for me _generally_
works for everyone else, too.

Using dynamic properties is one of the areas where "works for me" and
"works for everyone else" can diverge. Some people use static analysis to
keep track of those divergences, but if PHP _can_ warn people they're doing
a probably-dumb thing, I think it should.

I encourage people to vote "yes" on this, if you want PHP to be better at
preventing people from shooting themselves in the foot. I know there are
valid uses for this, but it's nevertheless a surprising feature, and not
one that delights many PHP developers. Making it attribute-only from 9.0
onwards seems incredibly sensible.

Best wishes,

Matt

---

## #116395 — Chase Peeler — 2021-11-15T22:31:53+00:00

URL: https://staging.externals.io/message/116325#116395 · In reply to: #116394

On Mon, Nov 15, 2021 at 4:40 PM Matthew Brown <matthewmatthew@gmail.com>
wrote:

> 
>
> > […]
>
> There are two things developers think about when releasing code:
>
> 1. does it work for me
> 2. does it work for everyone else
>
> With its support for runtime type hints and other similar checks, PHP does
> a reasonably good job of aligning those two — what works for me _generally_
> works for everyone else, too.
>
> Using dynamic properties is one of the areas where "works for me" and
> "works for everyone else" can diverge. Some people use static analysis to
> keep track of those divergences, but if PHP _can_ warn people they're doing
> a probably-dumb thing, I think it should.
>
>
Warning someone is very different than not allowing it


> I encourage people to vote "yes" on this, if you want PHP to be better at
> preventing people from shooting themselves in the foot.


What if I want a language where people can shoot themselves in the foot
because the flexibility it offers is what makes it great



> I know there are
> valid uses for this, but it's nevertheless a surprising feature, and not
> one that delights many PHP developers.


Why is this surprising? It's been available since classes were introduced
to PHP.


> Making it attribute-only from 9.0
> onwards seems incredibly sensible.
>
> Best wishes,
>
> Matt
>


-- 
Chase Peeler
chasepeeler@gmail.com

---

## #116397 — Matthew Brown — 2021-11-15T23:36:04+00:00

URL: https://staging.externals.io/message/116325#116397 · In reply to: #116395

>
>
> On Mon, Nov 15, 2021 at 4:40 PM Matthew Brown <matthewmatthew@gmail.com>
> wrote:
>

>
> > […]
>
>
> What if I want a language where people can shoot themselves in the foot
> because the flexibility it offers is what makes it great
>

I don't think this particular feature makes PHP great, and I don't think
the active PHP community thinks that either.

I know there are
> > […]
>
>
> Why is this surprising? It's been available since classes were introduced
> to PHP.
>

Not everyone who uses PHP has been using it since time immemorial. Some of
us came from compiled languages where this behaviour is expressly
prohibited, while others are used to interpreted languages that  also
prohibit this behaviour.

This is what I mean by surprising: I have heard newcomers express literal
surprise when discovering this for the first time, and not in a delighted
way.

Best wishes,

Matt

---

## #116400 — Pierre Joye — 2021-11-16T03:52:09+00:00

URL: https://staging.externals.io/message/116325#116400 · In reply to: #116394

Hi,

On Tue, Nov 16, 2021, 4:40 AM Matthew Brown <matthewmatthew@gmail.com>
wrote:

> 
>
> > […]
>
>
> I encourage people to vote "yes" on this, if you want PHP to be better
>

My vote will change to yes as soon as the change is an opt-in instead of an
opt-out for the 8.x lifetime.

best,
Pierre

---

## #116403 — Lynn — 2021-11-16T09:11:32+00:00

URL: https://staging.externals.io/message/116325#116403 · In reply to: #116400

>
> My vote will change to yes as soon as the change is an opt-in instead of an
> opt-out for the 8.x lifetime.
>
>
What is the point of this change if it's an opt-in? Projects that are still
relying on dynamic properties today and "have no time" to fix them now,
won't have time in 3 years either. Please let us have nice things today
instead of years from now :)

---

## #116409 — Pierre Joye — 2021-11-16T12:22:52+00:00

URL: https://staging.externals.io/message/116325#116409 · In reply to: #116403

>
>
>
> 
> > […]
>
> What is the point of this change if it's an opt-in? Projects that are still relying on dynamic properties today and "have no time" to fix them now, won't have time in 3 years either. Please let us have nice things today instead of years from now :)

If it is an opt-in (like Larry proposes f.e.), you will have them
today as well.

Best,
-- 
Pierre

@pierrejoye | http://www.libgd.org

---

Next page: https://staging.externals.io/message/116325.md?page=2
