PHP

freekmurze,
@freekmurze@phpc.social avatar

🔗 Dreaming of nested properties in PHP
https://sebastiandedeyne.com/php-wishlist-nested-properties/

dgoosens,
@dgoosens@phpc.social avatar

@freekmurze

there is an old RFC for structs:
https://wiki.php.net/rfc/structs

dgoosens,
@dgoosens@phpc.social avatar

@gmazzap @freekmurze

Mmmh I understand but there are really two distinct issues here… well three actually

  1. Struct is the construct most other languages use (ao rust) and thus it makes sense to respect that structure
  2. array_ functions in … I hope to see an rfc to extend their usage to all iterables
  3. For stricts, it would be required to pass the key to the callable of the array_ functions (currently not supported sadly
ramsey,
@ramsey@phpc.social avatar

Last night, I tagged the first “stable” version of socialweb/atproto-lexicon.

It’s a schema parser for the , and it should come in handy for code-generation purposes—that’s what I’ll be using it for.

As usual, I’ll probably see much more engagement with this post here than I do on . 🤣

@activitypubblueskybridge

https://github.com/socialweb-php/atproto-lexicon/releases/tag/0.1.0

ramsey,
@ramsey@phpc.social avatar

@kboyd This is also a very interesting discussion over on Bluesky. It seems that Bluesky is really just a proof-of-concept for the protocol, and it’s not Jack’s intention that the service stick around but that other services take its place.

chucker,
@chucker@norden.social avatar

@justin @ramsey @kboyd you can generate a lot of media buzz with a “decentralized” protocol that has a suspicious amount of centralized single points of failure

andrewfeeney, (edited )
@andrewfeeney@phpc.social avatar

Folks, if you parrot opinions like "PHP is an insecure language" or "PHP has inherent security flaws" in 2024, and you can't point to specific issues with modern, current versions of PHP to back it up, all you are doing is demonstrating your ignorance.

The fact is, modern is every bit as secure, solid and performant a server-side platform as , , or many other popular languages.

andrewfeeney, (edited )
@andrewfeeney@phpc.social avatar

Yes, it's got a history. We know the history well. We know the painful ways of old. Yes, there is unpatched and otherwise insecure legacy code out there in the wild. Yes you can find examples of terrible code in old blog posts. But if you haven't updated your opinion since that time, you are running on outdated intel.

We learned the hard way. We hardened our language, our knowledge and our practices as a community over decades of experience making popular and profitable web applications.

andrewfeeney, (edited )
@andrewfeeney@phpc.social avatar

is a living language with a vibrant, thriving and extremely knowledgeable community. Is PHP the best language? That's subjective. Is it a solid and trustworthy option for a modern web app or back end service in 2024? Absolutely.

You may hate the language and that's your prerogative. Everybody has their preferences & they are valid. But if you want to accuse PHP of general vague badness or insecureness, you better have specifics to back it up. Specifics that apply to PHP in 2024, not 2012.

dseguy, (edited ) French
@dseguy@phpc.social avatar

How big are your source code ? Excluding dependencies (vendor folder)

Generally, is quite compact code, and requires few expressions to achieve its goal.

The largest OSS are 4.9 MLOC (una, bitrix), while the majority is well below 2 000. The figures below partition OSS projects in 4 part of equal size.

Where are you ?

velkuns,
@velkuns@phpc.social avatar

@dseguy some under 300, some under 1k, and 3 under 5k for my OSs projects.

For website parts, it depend of complexity of projects (~5k for my wife website and ~ 30k for my Mtg website, with lots of domain complexity and some duplicated parts without cleaning of old parts 😅)

askonomm,

@dseguy Holy crap I can't even begin to imagine what it must be like to work with a 4.9MLOC project, and what kind of organisational issues you might stumble upon.

valorin,
@valorin@phpc.social avatar

Overly complex code is a common source of security issues, one I often see when devs attempt to avoid filename collisions…
https://securinglaravel.com/p/security-tip-avoiding-filename-collisions

michael,
@michael@thms.uk avatar

@valorin this is interesting. My personal go to is usually Str::uuid() to get a UUID.

Essentially just even more randomness than you suggest, isn’t it? Or is there any downside?

timwolla,
@timwolla@phpc.social avatar

@j3j5 @valorin @valorin

The only reliable protection against timing attacks is using operations that are inherently constant time based on their construction. hash_equals() would be an example that is included in PHP itself. You should always use hash_equals() to compare strings that are secret / sensitive.

Girgias,
@Girgias@phpc.social avatar

So trying out my custom domain to send emails to the internals list and it falls in the spam folder in GMail, which is confusing :|

Anyway, new RFC: https://wiki.php.net/rfc/http-last-response-headers

timwolla,
@timwolla@phpc.social avatar

@heiglandreas For non-DMARC p=reject domains the From header will be the original one. That's why Gina's email was marked as spam, as DMARC mangling was not performed for it (due to p=quarantine).

heiglandreas,
@heiglandreas@phpc.social avatar

@timwolla Yeah. That's the same for my emails to the list as well...

Question is whether we can extend the non-mangling also to p=quarantine

jrf_nl,
@jrf_nl@phpc.social avatar

PHP_CodeSniffer users: please read this important announcement: https://github.com/squizlabs/PHP_CodeSniffer/issues/3932

squizlabs/PHP_CodeSniffer is dead, long live PHPCSStandards/PHP_CodeSniffer!

Also, please consider sponsoring the project to safeguard its continuation, as without funding, we'll have the same problem again sooner rather than later.

P.S.: @phpcs now also has its own account, follow it to stay informed.

permanenttourist,

@jrf_nl Haha! I just initially saw what you shared and not that you are the one who is maintaining the project. If I'd've known that, I would've done my own leg-work to find out what I need to know. 😅

jrf_nl,
@jrf_nl@phpc.social avatar

@permanenttourist Never a bad thing to do your own legwork anyway, you can always still ask if you haven't figured things out after.

dseguy, (edited ) French
@dseguy@phpc.social avatar

Here is the PHPuzzle of the day. Which of the following line is wrong in PHP 8.3 ?

Assume that all needed definitions are available for this to run.

admin,
@admin@mastodon.adtension.com avatar

@dseguy
Is this a good start?:

class A {
const string A = 'A';
}

dseguy,
@dseguy@phpc.social avatar

@admin It is.

jclermont,
@jclermont@phpc.social avatar

As always, I'm pretty non-committal, but @aaronsaray has a definite opinion on the topic of final classes in . And, as always, we keep the podcast to 15 minutes or less. https://show.nocompromises.io/episodes/when-should-you-use-final-classes-or-private-properties

video/mp4

aaronsaray,

@Girgias @zimzat @Crell @jclermont The thing about all of this is - I didn't have to worry about any of this with the best programming language I've ever touched... gw-basic. 😆

Girgias,
@Girgias@phpc.social avatar

@aaronsaray @zimzat @Crell @jclermont Truly, making sand think was a mistake :p

ctietze,
@ctietze@mastodon.social avatar

A question for more experienced developers than me:

We have this setup where all requests go through a PHP script for authorization (think: cookie) checking before serving files.

That's fine with HTML, but less ideal for 5MB PDFs.

I'm trying to search for ways to use PHP to allow/deny access, but otherwise let the web server (Apache) do its job.

Is there such a facility to rewrite requests for auth, but then go on serve the static files?

Crell,
@Crell@phpc.social avatar

@ctietze @joby @deanatoire Pretty sure yes. If you wanted to do that, there's some complex and rarely used HTTP headers that you'd have to handle manually, then work on the streams yourself. That would definitely be slower, but assuming my benchmarks are still vaguely correct, it wouldn't be orders of magnitude slower.

Unless that's a common issue for your use case, it's probably not worth the trouble.

Crell,
@Crell@phpc.social avatar

@ctietze 12 YEARS and you're the first person to spot that... Humans really are bad at proof reading. 🙂

Fixed now, thanks.

ramsey,
@ramsey@phpc.social avatar

This article is all about how things are looking great for hiring Laravel devs in 2024, and I’m not seeing it.

I’ve been job-searching for 3 months, and very, very, very few of those jobs are decent-paying / jobs. Sure, PHP/Laravel jobs exist, but most (anecdotally) pay far less than the rate others are willing to pay for , , , , , , and developers.

The industry does not value the output of PHP developers.

https://laradir.com/blog/why-laravel-could-see-a-huge-rise-in-adoption-in-2024

sean,
@sean@scoat.es avatar

@shiflett @ramsey @wez I hadn’t yet sent @ramsey an invitation to join our chat but maybe @wez would like to join, too. I miss you all. (-:

brammm,
@brammm@phpc.social avatar

@ramsey Yep, had the same experience last summer. For the first time myself, I feel like PHP might be actually be on a decline. And I sort of get it? I've been doing a lot of TypeScript lately and the DX is just... better. If you look at what C# brings to the table for API development, it's pretty nuts and I could definitely see why larger companies invest in that.

syntaxseed, (edited )
@syntaxseed@phpc.social avatar

Where does everyone store the files for enums & value objects?

  • src/
  • controllers/
  • entities/
  • repositories/
  • services/
  • views/

Another 2 sub directories under src/ ?

Some kind of types/ subdir then enums/ and objects/ under that? 🤔

gmazzap,
@gmazzap@phpc.social avatar

@Crell @syntaxseed Agreed. Organizing things by what they do isn't optimal. Imagine to organize a house like that: a room for things that throws water, like kitchen sink and the shower, and another for things that emit warm, like fireplace and stove. If you organize thing semantically, you can have a folder with some views, some controllers, enums, value objects, etc, all related to the same conceptual part of the thing. Another folder with other views, other controllers, etc.

thgs,
@thgs@phpc.social avatar

@kniziol @syntaxseed my enums or value objects are sociable and polyamorous. It is sometimes vague who they primarily collaborate with.

ramsey,
@ramsey@phpc.social avatar

I’m trying to run “Debug” (for step-debugging with ) in while running a test. I do this all the time with standard tests, and I’ve never had this problem…

The test runner stops immediately, and PhpStorm reports in the debug console, “Test framework quit unexpectedly.”

Has anyone else seen this error? Do you know what causes it?

ramsey,
@ramsey@phpc.social avatar

Oh… wait! I probably need to tell PhpStorm to use vendor/bin/pest to run the test, rather than vendor/bin/phpunit.

gwynae,

@ramsey Someone hardcoded something.

ramsey,
@ramsey@phpc.social avatar

Who will I see at next week? I’m giving a keynote on Thursday, and I’m super nervous. It’s only the second keynote I’ve ever given, and the first one was over 10 years ago. 😬😰

omnicolor,
@omnicolor@phpc.social avatar

@awoodsnet I would have loved to attend both, but some jerk is speaking at the same time as your first one, and I gotta attend that one. Looking forward to the dotfiles talk though!

sarah,
@sarah@phpc.social avatar

@ramsey I’ll be there! My whole team is coming.

codito, Polish
@codito@mas.to avatar

How's that possible that people like @OndrejMirtes or Keradus don't have RFC voting rights? It does not make any sense. Language should be evolving under an eye of people who know it most, not people determined enough to check all the points of the onboarding list.

Girgias,
@Girgias@phpc.social avatar

@codito @OndrejMirtes Well yeah, because as far as I understand, the RFC process got introduced around the PHP 5.3 era because people, rightfully so, were displeased that decision were done completely random and in the dark.

And it hasn't really evolved from that point

Crell,
@Crell@phpc.social avatar

@Girgias @codito @OndrejMirtes Indeed. The fixes the RFC process needs are not confined to "give more people a vote." As currently setup, everything is spec work. Moreso than most OSS projects, everything is spec work. That's frankly abusive.

I have thoughts on improvements, but it's been made very clear that there's enough people who like the current abusive/chaotic status quo that they'll only participate in order to keep it as is that improvements are likely impossible.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • php
  • kavyap
  • InstantRegret
  • ethstaker
  • DreamBathrooms
  • mdbf
  • magazineikmin
  • thenastyranch
  • Youngstown
  • tacticalgear
  • slotface
  • Durango
  • khanakhh
  • rosin
  • everett
  • Leos
  • vwfavf
  • normalnudes
  • osvaldo12
  • cubers
  • GTA5RPClips
  • cisconetworking
  • ngwrru68w68
  • anitta
  • provamag3
  • tester
  • modclub
  • megavids
  • JUstTest
  • All magazines