Replies

This profile is from a federated server and may be incomplete. Browse more on the original instance.

dseguy, to php French
@dseguy@phpc.social avatar

question of the day : when you know that
2*2 = 4
2^2 = 4 (too)
2.5^2.5 = 9.8821176880262..

Where is this 6 coming from ?

cabbey,
@cabbey@phpc.social avatar

@dseguy I assume this https://3v4l.org/3E7BL snippet captures your complaint? (3v4l is the preferred way to share code snippets over screen shots.) specifically that the fourth print should be 4 not 6

If I had to guess, it’s something about operator precedence between the cast and the exponent. But that’s downright weird given the multiplication gets it right. Probes out by adding more parentheses: https://3v4l.org/gXvRL

kboyd, to random
@kboyd@phpc.social avatar

Ran a database query at work to investigate a hunch, and forgot about it.

And, an hour and 19 minutes later ... the hunch played out, but much less severely than I had anticipated. Most curious. Yay results!

cabbey,
@cabbey@phpc.social avatar

@kboyd data driven whatever for the win.

ramsey, to php
@ramsey@phpc.social avatar

I’m about to do something that could either be very controversial or not controversial at all and result in a bunch of shrugs and nods.

cabbey,
@cabbey@phpc.social avatar

@ramsey gunna use a goto in production code?

ian, to random
@ian@phpc.social avatar

I hear RISC is good

cabbey,
@cabbey@phpc.social avatar

@kboyd @ian Power (PC) to the people!

cabbey, to php
@cabbey@phpc.social avatar

ok folks, you were right Rector is pretty cool. The learning curve is steep AF, and the docs are, well, let's just say they're written by engineers for engineers. But given the target audience for this tool, that's OK. I've not yet done the changes I was originally asking about with it, because the config for it is going to be a PITA to build. I've been starting small. But what I've done so far has been pretty cool! I've done some wild things with RenameClassConstFetchRector for example. 🧵

cabbey,
@cabbey@phpc.social avatar

BUT... this brings me to two questions that don't seem obvious from the docs and sources. 1. as a result of moving some consts from one class to another, I now have a lot of files that went from 1 long use SomePackage\Name\Space\Here\To\AClass; and a ton of AClass::SomeConst to a lot of files with an unused import and a ton of very long fully qualified consts sprinkled through the code. Has anyone seen a rector to collapse frequently used namespaces into a use statement?

cabbey,
@cabbey@phpc.social avatar

AAHHHH... because it's not a Rector it's just a config option... ->withImportNames()

but that changes everything not just the things it touches... which ... omg ..... just no. (2000 files touched just by changing that setting.)

cabbey,
@cabbey@phpc.social avatar

@shudder no… 2000+ files that it touched to change “class Yada implements \NameSpace\Foo\Bar\SoupInterface” to “use \NameSpace\Foo\Bar\SoupInterface;
class Yada implements SoupInterface”

The vast majority of our codebase only imports the class if it’s used more than once in the file… this just undid that globally for two big classes of use cases: implementing interfaces and trait usage.

The actual changes I had been making in rector.php only impacted a couple dozen files.

cabbey,
@cabbey@phpc.social avatar

@alessandrolai @shudder yeah, played with them to not much improvement. Currently thinking I’ll do a two pass approach. First use the renaming rectors I’ve configured against the whole codebase, then got diff to get the list of changes files and run a separate rector on just those files with this option. Will experiment with that in the morning.

cabbey, to ubuntu
@cabbey@phpc.social avatar

Anyone know how long it usually is between a release going GA and do-release-upgrade seeing it? Seems odd that I could download and burn the iso and do an upgrade with that, but can't do it from within the system yet.

cabbey,
@cabbey@phpc.social avatar

@Crell yeah, just trying to get a feel for how long the stagger is. But also meh… it’s not a lot of data, and it’s CDN’d pretty hard.

afilina, to random
@afilina@phpc.social avatar

Shout out to league/csv for continuing to be an awesome library. It's intuitive, a breath of fresh air after a long week of fighting every single tool. This one doesn't fight you. It just helps you without getting in the way.

cabbey,
@cabbey@phpc.social avatar

@afilina oooh! I didn't know this package existed. I think pretty much every package from The League I've used has fit this description though, so that's a good sign. Sadly, after looking at it's docs, it doesn't even attempt to solve the biggest problem I think @kboyd and I see with writing csv files... managing the column positions when you have variable data. :(

cabbey,
@cabbey@phpc.social avatar

@afilina @kboyd say you have 50 columns... say 40 of them are populated in every row, but the other 10 you get some random subset (depending on what the other values maybe, you may have 10 of them or you may have 3 of them or somewhere between.) Then say you have another 6 or so columns that get added for certain customers but not for others.
It would be awesome if you could give it a header array and then pass in a hash for the row and have it populate just the ones that are set.

cabbey,
@cabbey@phpc.social avatar

@kboyd @afilina or a patch to add it if they're open to it.

cabbey,
@cabbey@phpc.social avatar

@afilina @kboyd ahh... I must have misunderstood what formatters could do... I thought they were processed cell by cell. If they get the whole record then yeah, that would probably work.

grmpyprogrammer, to random
@grmpyprogrammer@phpc.social avatar

Making my traditional stop at Cracker Barrell

cabbey,
@cabbey@phpc.social avatar

@grmpyprogrammer ooh, they still exist? All the ones out here closed last year.

andrewfeeney, to php
@andrewfeeney@phpc.social avatar

and folks, what do you make of this?

https://youtu.be/kQdRT2odUIk

cabbey,
@cabbey@phpc.social avatar

@andrewfeeney @arnan @valorin @mergy we don’t know yet.

But assumed worst case: there is some magic string that if they can get your web server to spit it out, in that encoding, can be used to dump anything php has access to… or run any arbitrary assembly… as your php user.

There are probably a dozen lesser degrees too.

Disclaimer: I’m not a security researcher either… it’s been 20+ years since I sat down and crawled through any code looking for malicious ways to abuse it.

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