« first day (3502 days earlier)      last day (1429 days later) » 

Wes
1:17 AM
it consumes me having to find examples of code when writing about programming. if the examples are too complex they distract from the actual point i am trying to make, if they are too simple it sounds like there's no problem to solve
like i am trying to find a real world scenario in which strings are compared case insensitively and i cannot think of nothing better than the social security number, which is not even alphanumeric everywhere in the world. it is here though :(
license plates maybe
 
1:37 AM
@Wes Say you are implementing a programming language, and in such programming language class, method, and function names are case insensitive...
 
Wes
> Say you are implementing a bad programming language, and in such programming language class, method, and function names are case insensitive...
:D
 
I also like the salt in that
 
Wes
:P
 
 
2 hours later…
3:49 AM
@LeviMorrison +1000! :)
 
 
3 hours later…
6:19 AM
@Girgias The PHP codebase needs a "deep clean"
There is a major accumulation of cruft all over
Which makes it more difficult to understand the code and fix bugs
Thanks for making the situation better
 
 
2 hours later…
8:17 AM
HTTP PUT description inadequate ・ Documentation problem ・ #79610
 
9:14 AM
@crell found the data oriented programming aka data oriented architecture aka entity component systems notes:
https://medium.com/ingeniouslysimple/entities-components-and-systems-89c31464240d
http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/
http://t-machine.org/index.php/2007/11/11/entity-systems-are-the-future-of-mmog-development-part-2/
and the bit I knew I couldn't explain well; it's nice that programming around data structures just happens to give better cache coherency, but the more powerful thing it does it to allow 'objects' to be programmed in unexpected but interesting ways:
> Do Cameras shoot people?

Do Bullets accept input from the player?

No?

Well … have you played Unreal Tournament? If you have but didn’t answer yes to the earlier questions then you need to find someone to show you a Redeemer being used in Alternate Fire mode (hint: you get to manually “fly by wire” the rocket from a first-person view inside the warhead itself).
 
9:47 AM
Can someone please explain to my why short tags were told where to go in 7.4? I always thought <?= was useful in templates, for example...
 
<?= is not going anywhere
 
Or maybe I'm thinking of <?
 
They were talking about <?
 
Ah, thought so. What's the name of the one I was referring to? Not "short tags" no?
 
Short echo?
 
9:49 AM
Thanks :)
 
10:01 AM
@Girgias there's 3 separate areas. First - their is a general 'humans are shite at communication particularly with our current tech solutions' problem. That is something I'm working on....but that might take a while.
Second - I am increasingly frustrated at the PHP group not having any paid positions. There is a ton of work that should be done for the project, that is really tedious to do, like triaging bugs, triaging PRs for docs and probably proof reading other people's RFCs. Obviously I have helped out some people a little, but the chances of me volunteering to help some of the more stupid RFCs is minimal.
Helping people write clearer RFCs, or at least talking to people and helping them understand what the challenges are in their idea, would be something that would help, but can't be expected to be done on a volunteer basis for everyone who wants to submit an RFC.
third - there are small process improvements to be done. I think the text for RFCs need to be held in a place where there can be pull-requests (though not on a github repo where anyone in the world can wander past and drop the ideas extracted from their rectum).
 
@Jimbo As the author of that whole debacle, as IluTov said it's only about <? and the reason is that it's engine behaviour toggled by an INI setting, which for reasons I still don't understand, is enabled by default although it has conflicts with XML (and possibly other formats, but mostly XML)
 
I would also like proposed votes to be held in a format where there can be PRs for them, so that people can tweak the wording to be clear, or split as appropriate. And also for the opening and closing of votes to be carried out automatically. As well as providing a data feed for "these are the things that are going to be voted on soon."
I am going to knock something up for that.
 
I was thinking about needing a new platform anyway
If you start on it do let me know :)
@Danack I mean from what I understood the PHP Group is just something which holds the trademark and even that is debatable, I imagine setting up a new non-profit organization which can be funded by donations to pay people to do tasks that you've mentioned is maybe a better way than trying to piggyback on the already weird and vague PHP Group
@AlexD It does indeed :p I think it's mostly ok, but some parts are pretty hard to understand like ext/sockets/conversion.c :/
 
@Girgias even better, charter it under an existing non-profit; I'd happily donate to a PHP Foundation, but it would be a shame if it just sucked out more time getting the paperwork right
 
@Girgias rather than non-profit (which can actually be quite difficult to run) setting up a normal company, that doesn't have any authority over internals, but just hires people to work on internals stuff might be better.
 
10:15 AM
@IMSoP That would be better, but I don't know enough about OSS and which foundations would takes us under their wings
 
yeah, I don't know the landscape well, but I notice Laminas (Zend Framework) is chartered under the Linux Foundation
 
@Danack But how are you meant to make a profit? I mean I don't know enough about how companies work but I would expect that they have some kind of duty of making a product and a profit?
 
you only have a duty to your owners
a privately owned company is free to waste money however it wants; but people are free not to give it that money :P
 
Well yeah lol
 
the importance of being a non-profit is that it opens more sources of money: grants, tax deductible donations
 
10:21 AM
@Girgias it's not the profit seeking - it's the "not having to jump through the quite annoying hoops" that being a non-profit requires. For example, a non-profit can't always tell someone "why don't you go and work on what you want to for 3 months", as the rules around non-profits would look at that as an attempt to money launder.
 
well, yeah, kind of rightly
 
@Danack huh, I mean as said I have no clue about how these things work lol
 
if you're accepting donations, you need to be able to tell people what they're funding
AFAIK, "making PHP better", but worded by a lawyer, would be a legitimate purpose for a non-profit
 
The downside of that is that you have now spent time talking to a lawyer, rather than working on code.
 
right, hence "charter under an existing foundation"
 
10:24 AM
To save everyone some time in about a week....
 
if you just want to pay people, with occasional updates on what they're up to, something like Patreon seems more relevant
I don't how well Derick's is working out
either way, the aims are: a) reassure people their money is going somewhere useful; b) outsource as much of the administration as possible
 
@IMSoP @Girgias There is a german non-profit entity set-up that could do this. It's about a year old, but they haven't done anything with it. I think Stefan Priebsch (from the phpCC team) is heavily involved.
@IMSoP My Patreon pays for about 11 hours a month of my time, as per xdebug.org/log
GitHub sponsors adds another 4 hours
oh, that was March
I wonder why APril isn't there yet
 
that reminds me, I don't think I'm paying you anything yet, I must remember to do that :)
 
@Derick Based on what hourly rate?
 
It's complicated
It's different with the corporate sponsors... and I don't want to get into it.
It's less than my contracting rates.
 
10:34 AM
Fair enough
@Derick That I assumed
:)
 
@IMSoP cheers :-)
 
좋은아침
 
 
1 hour later…
12:02 PM
Callable types + function +callable type autoloading - though that second doc is mostly just ircmaxells doc.
I deleted the bits that were nuts, and some of the typos. I also removed the ability to do 'inline types' to make the RFC be smaller.
Most useful bit of feedback would be if there is any show-stopper problem with it...obviously with deadlines for RFCs, I might announce it on the list before too long...
 
@Danack isn't __autoload removed as of PHP 8?
 
@Girgias I wasn't aware anything had changed there... linky?
 
che-oirs.
words will need updating then. But the ability to load functions and callable types will still be needed.
 
Oh for sure, but you can drop a section :)
 
12:19 PM
o/
 
@Danack if it's built off my earlier work, any objection to provide a citation?
 
@ircmaxell Not object and will do. In the same form as I did for mixed - wiki.php.net/rfc/mixed_type_v2 or would you prefer different format?
 
@Danack I'm not too concerned with specifics, as long as it's there (if it's really derivative), then that's good by me :)
 
cool.
possibly could be different as I'm at least speaking to you, whereas that other guy......not so much.
@Girgias ^^ that is another thing that could be improved on the RFC process. That when an RFC has not been successful, it's fine for other people to pickup the work, but that they should be given credit. Setting that out as the normal procedure, would avoid the accusations of stealing that have happened.
 
@Danack I mean there are already some vague-ish lines about this ni the RFC process doc iirc, but yeah agreeded
 
12:45 PM
@Danack I feel quite strongly of being able to express all types inline which can be put in a typedef. I think this must be part of the RFCs scope for it to be viable.
(well, maybe with the exception of recursive types, but these are very rare)
 
@bwoebi I feel the same :)
 
As much as I like them, in my experience most explanations of what signature of callable is expected is right next to the function decl, in the phpdoc comment above it. In the bare function scenario, you could argue the types can be defined right above them. In the scenario of any non-trivial class, you'd have to look at least on the top of the classes, creating quite the spatial separation.
Excluding inline callable defs IMHO very much does not reflect real world usage of them
Also well, I'd prefer type foo = bar; over typedef foo = bar; - you assign a type, you don't assign a typedef, … (If syntax were like typedef foo { bar } or similar, then it would be "type definition of foo: bar"…)
I can't think of any precedent for typedef with an = equals sign in other languages - either it's type foo = bar or typedef foo bar
It's not a strict blocker for me, but it definitely feels weird.
 
1:02 PM
I usually have a hard time finding good names for short-lived (or scoped) typedefs.

typedef ArrayMapCallable = callable(mixed): mixed;
function array_map(ArrayMapCallable $callable, array $array);
It would make more sense for this to be inline, for example.
 
I have a hard time naming many things.
 
@IluTov Thanks for spelling that point out as well :-)
 
> Although they are not used in the definition of a callable type, the parameter names are required in the callable type definition, to allow callable types to be compatible with calling by named parameters.
I'd also prefer to allow omitting variable names, as most of the time closures just take 1-2 params where named parameters are much less useful.
 
@PeeHaa oops. Probably caused by a batch I'm running to run all scripts through all versions to improve the bughunt
 
LOL! Andreas says "...pardon my French..." proceeds to actually speak French youtube.com/watch?v=cQZBS3u3SeU&t=30m35s
 
1:56 PM
@IluTov I guess if they were optional callable(string $message):void could be considered a sub-type of / more specific than callable(string):void, in terms of contravariance etc
 
cmb
Cool! 2 ini settings for the same property: github.com/php/php-src/blob/php-7.3.18/sapi/phpdbg/…
 
Hm, not sure if that's right. I'm assuming:
foo (callable(int $foo): void) {}
foo(function (int $bar) {});
should work, right? I'm actually not sure if named callable parameters are a good idea at all.
 
if you use the name, you'll get an error; if you don't use the name, don't specify it in the type
 
Not a fan...
If libraries specify it you'll be forced to use the same variable name. Seems kind of odd.
 
function foo( callable(string $message):void $logger ) { $logger(message: 'hello'); }
foo ( fn($message) => print($message) );
@IluTov well, that's named parameters all over; if the library calls your function with named parameters, you've got to give them the right names
 
2:03 PM
@IMSoP Except that my example doesn't even use named parameters.
 
if I call the above with foo( fn($x) => print($x) ); it's going to fail one way or another
right, so don't specify the names in your callable type
function foo( callable(string):void $logger ) { $logger('hello'); }
meaning "I don't care what you call your parameter, as long as it accepts strings"
 
I get it, I'm just not sure if that's a good idea.
 
I don't know what the alternative is
 
Me neither ^^
 
I'm not really seeing the downside, though
it's just options of how specific you want to be - callable, callable(string), callable(string $message)
 
2:07 PM
Specifying variable names is mostly useful for documentation. For example:
callable(mixed, mixed): mixed
vs
callable(mixed $value, mixed $key): mixed
but just because you want to document it doesn't mean you want to enforce all closures to use those exact variable names
you'd also need to wrap an existing callable in another closure just to make the parameter names conform
 
@IluTov I think this should happen transparently in the engine at that point
so that named params could be actually used, with the names in the function signature of the receiving function
which again has problems when you call call($cb, ["arg" => 1]); where $arg is the name of the first arg of $cb…
Probably we cannot solve this at all. We will just have to accept that the param names in the callable type signature are merely informational and have no meaning in named params
 
@bwoebi I think I'd prefer this as well. As mentioned, I think most closures only have 1-2 params anyway where named params are much less useful. Which param names to use can become pretty confusing with any solution.
 
exactly
 
2:23 PM
@IluTov hm, I guess in a typedef that would be useful
I was thinking of inline definitions (which I agree should be allowed), where having the names would be more confusing than helpful anyway
it feels kind of adjacent to the question of how inheritance and interfaces should work
 
@IMSoP well, "is it $key, $val or $val, $key"?
that information you also want to be able to extract from an inline def
 
sure, but in an inline definition, it's just a mess: function doThing(callable(string $key, string $value): string $callback, string $other): string
for simple inline cases, omitting the names would be the norm I think
 
I don't see a hard issue with that, but it depends mostly on how big the signature is. Also signatures can be expanded into multiple lines, making it more readable again
@IMSoP yes, depends on the use case
@IMSoP and no, it's rather orthogonal to that. For inheritance, you are directly inheriting from something - you have control over that to an extent. For callables (in callee scope), you just get some arbitrary function and it may or may not match your names
 
2:44 PM
it's the same as interfaces, though, no?
interface Logger { public function log(string $message): void; }
type LogCallback = callable(string $message): void;
both are contracts, and the question is "is the name $message part of the contract?"
 
@Danack Interesting. Still seems not-relevant for the majority of PHP use cases. :-)
 
3:24 PM
@IMSoP yes, but the former is a static contract, the latter a contract decided at runtime depending where the callable is passed to
 
yeah, there's a difference between implicit and explciit; but I feel like it's still quite related
if you know you're passing to a library that typedefs its callables, you're actively trying to meet that contract
and the same argument applies, that most interfaces name their arguments for documentation purposes, rather than because they really care if that name is canonical
and will continue to do so even if/when named parameters are possible
 
Hello guys.

I am facing issue in attaching a file in php mailer library.
$mail->addAttachment("https://".$_SERVER['HTTP_HOST']. "/covid/assets/uploads/15881003161.txt");
 
Wes
\o
 
@NomanJaved 1) this is not enough information, which PHP mailer library? 2) what issue are you facing? Please explain. 3) don't insert $_SERVER['HTTP_HOST'] directly, or more specifically, don't trust anything that can be manipulated by a user. (stackoverflow.com/questions/43941048/prevent-host-header-attack)
 
Wes
3:40 PM
i tried to write a "optional structural typing" for a while, then something stopped me because i didn't like it. but if you want to pursue the idea, it was like an operator that would resolve to the structure of a named type, for example:

interface IntegerPredicate extends callable{
    public function __invoke(int $v): bool;
}

function tryme(^IntegerPredicate $callable){
    return $callable(42);
}

tryme(function(int $v): bool{ return $v === 42; });
basically "^IntegerPredicate" means "the structure of IntegerPredicate"
 
Any other pecl account people getting spammed down by the guy trying to perform XSS?
 
@IMSoP I mean rather compile time vs runtme
 
@bwoebi isn't that just a different way of saying the same thing? an implict contract is always going to be checked "on demand"
and again, I was looking at it from the user's point of view, not the compiler's
as in "as a user, I need to meet this contract"
 
@IMSoP ah, that you mean. Was thinking implict as in inferable via static analysis.
 
@Tiffany I am using PHPMailer library. Issue is just attach files are not attached. no error, email also send but without attachment.
 
3:53 PM
> Explicitly does not support passing URLs; PHPMailer is not an HTTP client. If you need to do that, fetch the resource yourself and pass it in via a local file or string.
although in your case, it appears to be a file on your own server, so fetching it via URL is probably the wrong thing to do anyway
 
@IMSoP
if i set path by reference /covid/assets/uploads/158981045232k_new.txt
always got the error message :
Message could not be sent. Mailer Error: Could not access file
 
well that's a different question
 
$mail->addAttachment("/covid/assets/uploads/158981045232k_new.txt");

Message could not be sent. Mailer Error: Could not access file: /covid/assets/uploads/158981045232k_new.txt
am i doing any thing wrong in addattachment ???
 
note that a leading / means "root of filesystem" on Unix/Linux systems; like "C:\" on Windows
 
@IMSoP would prefixing a __DIR__ . '' solve that?
 
3:58 PM
@Tiffany if that's where the file is, yes
but remember that __DIR__ is the location of the PHP file where you wrote it, not the web root, or the file that got requested
 
Anyone have an opinion on this: github.com/vimeo/psalm/issues/3377 Does the current behavior make more sense, or does my proposal make more sense with PHP's current handling of array destructuring?
 
@IMSoP riiight, I get that mixed up some times.
 
easily done
 
I can avoid the issue in Amp if I declare that Stream::continue() returns Promise<list<TValue>>, but that's really true, since it's Promise<list<TValue>|null>.
 
@IMSoP Let me put it another way: with inheritance you only inherit a finite and well-defined amount of names (namely of the classes and interfaces it extends). It's well defined what names a class method will be able to be called with. With Closures, you can theoretically pass them to everywhere (matching the type signature). If you pass a closure through 3 different functions it would dynamically inherit new names on each function boundary, which is insane.
 
4:00 PM
Are ".user.ini" INI files read for every request, or just once per process?
 
@Tiffany best bet is to have a constant set early on in your startup/configuration that resolves to the root of your project, and reference everything else relative to that
 
e.g. const PROJECT_ROOT = '/blah/blah/blah/';
probably not using / though, whatever the constant is for directory separator (but then again, maybe / is fine, if you're not using the code across Linux/Windows, being cognizant of the platform the code is used on)
 
yeah; or dynamically like define('PROJECT_ROOT', __DIR__ . '/..') because you know that that line is in conf/config.php
 
@IMSoP This is how I've always done it.
 
sure, if we go with the "inheritance means adding aliased names" solution to the problem, that's awkward
my main point was that the *problems* of interfaces and callable-typedefs seem related
also, it's only insane if you try to trace it; within each context, it would make perfect sense
think of it more like "cast the callable to one with these names" rather than "inherit a base callable with these names"
it's actually simpler than the interface case, because you never have multiple aliases in scope
IMO, the signature function foo( callable(string $message):void $logger ) should guarantee the name message is available for that parameter, either by rejecting callables with a different name for it, or by silently translating calls to $logger(message: 'hello') to $logger('hello')
and maybe like inheritance, reject fn($b ,$a) if expecting callable($a, $b)
having $logger(message: 'hello') fail based on the runtime value of $logger, even though you mentioned that name in your signature, would be a real WTF
 
that doesn't really say anything...
 
/me waves
 
Wes
\o
 
cmb
@Derick time-to-live implies that the files are re-read; and on Windows FCGI at least, that works
 
4:51 PM
the code looks like it's just pre-request anyway
 
5:31 PM
Hey @Wes !
 
Wes
\o
 
Wes
izzame
 
5:48 PM
PDO ODBC- Informix segfaults when fetching data using bound parameters ・ PDO ODBC ・ #79611
 
6:14 PM
@IMSoP except if your input variables are not from the current scope (as its the case with function f(callable(string $a) $cb, $args) { $cb(...$args); } f(function(string $x) { var_dump($x); }, ["x" => 123]);
(this is an excessively contrived example, but this does happen e.g. in Amp with callbacks, you can there pass an extra $data arg as last arg, which will be passed to your closure when called)
 
@bwoebi then don't declare the callback with an expected parameter name; I don't really see the problem
note that what you've written fails anyway (in strict_types=1 mode) because you've passed 123 but were expecting a string
 
@IMSoP a) I don't use strict mode and b) whatever :-D
@IMSoP but you're right, I could skip it…
 
function foo(callable(SomeInterface $x) $cb, $args) { $cb(...$args); }
foo(fn(SomeInterface $x) => 'whatever', [$someThingNotOfSomeInterface]);
that fails for exactly the same reason, but on the type of the argument rather than its name
if the callable is allowed to be flexible, the signature shouldn't be specifying its details
 
6:40 PM
Sorry, is there anyone who can help me here... any tips on how to build zend_test.so?
Did ./configure --enable-zend-test; make
Trying ./configure --enable-zend-test=shared
Hmm. It built zend_test.so, but loading it as an extension fails with "Invalid library (maybe not a PHP library)" error. Looking at ext/standard/dl.c shows that PHP is looking for a symbol called get_module or _get_module. Running "nm modules/zend_test.so" shows that there is no such symbol in the .so.
Patched ext/zend_test/test.c so it works. Still not sure what I did wrong, though.
 
7:06 PM
have you run phpize?
 
 
2 hours later…
too many RFCs... lol
 
There's never too many RFCs :)
 
until they can't fit in one chat message
 
cmb
8:53 PM
@AlexD for Travis, it's loaded via dl(): github.com/php/php-src/blob/master/.travis.yml#L97
 
9:10 PM
TIL: DatePeriods $recurrence count is a 32 bit integer...
why…
And here I was, trying with PHP_INT_MAX and wondering why iterating it did nothing … var_dump releaved recurrence to be 0…
 
 
1 hour later…
10:14 PM
@cmb How does that even work? It's not thread-safe, is it?
 

« first day (3502 days earlier)      last day (1429 days later) »