« first day (3383 days earlier)      last day (1548 days later) » 

2:44 AM
We maybe should talk about wiki.php.net/rfc/trailing_whitespace_numerics again on internals for 8
@Tiffany didn't you "fix" this by any mean? bugs.php.net/bug.php?id=78677
@cmb as you closed the related bug, should this one also be closed? bugs.php.net/bug.php?id=78425
 
 
5 hours later…
cmb
7:36 AM
@Girgias the closed ticket was about an actual bug which has been fixed; the still open ticket is about docs which are not yet fixed.
 
user10141648
7:59 AM
https://stackoverflow.com/questions/30414860/how-can-i-define-a-route-differently-if-parameter-is-not-integer

How do I do this when I don't use a framework like laravel
 
user10141648
$router->get('users/delete/{id}', 'UsersController@delete');
 
8:14 AM
@Derick that's fine. we got gin and beer in the office, too.
 
8:38 AM
@NikiC fine with you if i am merge Reflection defaults github.com/php/php-src/pull/5071 then? no further feedback was provided.
 
9:09 AM
Quick question regarding the doc tool (edit.php.net). Once my changes are ready, how do I create / submit a patch?
 
moin
 
cmb
\o
 
@beberlei I've left two more comments, sorry for missing this earlier
 
@NikiC don't worry :) i am happy for thorough reviews on my PRs to src, will work them later
 
Windows 7 is now officially EOL. You can still upgrade to Windows 10 for free, but that may not last for much longer. Do it now.
4
 
9:29 AM
@SorinNunca When you edit a file and save the changes, they will be stored under the "Work in progress" section on the left, under your name (or your anonymous user). To create a patch out of a "work in progress" file, right-click the filename in that section and click "Submit as patch for review..." in the menu that appears. Fill in the details into the patch window and click "Create". Your changes will then appear under the "Patches for review" section.
 
Thank you very much. Wouldn't have ever figured that out :D.
 
@NikiC Fancy doing a podcast recording soonish? I count 4 RFCs :-)
 
10:03 AM
Is there a way to tell if a file can be rewound, other than catching the RuntimeException when it can't?
 
"stream wrapper supports seeking" is what you want
and yes there is a way, just reminding myself how
$result['seekable']
@jjok ^
 
Ahh, thanks.
 
10:28 AM
g'morning
 
cmb
\o
 
10:54 AM
@NikiC ref. does that work for everyone? from any repo (e.g. a fork)? just php/doc-en? just PR opener? only after approval?
 
@salathe It works for php/doc-en based on a user whitelist
(Which includes you)
Unfortunately it all gets committed via my account, because I need SVN commit credentials
 
11:12 AM
@NikiC How much flexibility do we want to bake into generics? Will we need to specify the generic object or will it default to everything?
 
@Girgias not entirely, I need to add the info about variance that already existed prior to 7.4.
 
\o
 
11:29 AM
o/
 
11:44 AM
@bwoebi I'm assuming it would default to what you put in the default
 
would generics as currently envisioned provide a way to supersede current declarations of "array", or would that be another step or require using types like "iterable<T>" instead?
 
I don't see how array itself could be replaced with generics
Too many internal functions change it that wouldn't respect typing I'd imagine. Are we expecting to have a baked-in collection type similar to it though?
 
@NikiC Yeah, I mean if you do new MyGenericClass() on class MyGenericClass<T> {...} - i.e. without type info on instantiation
(if there is MyGenericClass<T = int>, then obviously, it will be int by default - but if unspecified - allow all?)
 
@bwoebi I'd say required
You can do <T = mixed> to make it optional
 
@NikiC I think we should go by the usual PHP philosophy of making types optional
 
11:58 AM
@bwoebi Even if there has been an explicit opt-in to use them? ^^
 
@NikiC Well, should be opt-in to instantiate them
I don't care what certain library authors do
This has the additional benefit of allowing library authors to seamlessly add generics without breaking much of their users code
 
Would explode the first time it tried to load the class anyway no?
Invalid syntax in the file defining the class
 
the code using these libraries will just continue to work @NikiC
@NikiC What I could imagine in PHP is that we shrink the type of a generic type if permissible and required by a type the object is assigned/passed to
(if permissible means: subset of the current type and not colliding with existing properties)
 
@bwoebi Shrink in what sense
Depending on type parameter variance, the generic types will also have a subtyping relationship
 
@NikiC If you have Collection<anything> and pass that to Collection<int> -> it becomes a Collection<int> if no types are violated internally
 
12:05 PM
How can it "become" that though? We can't just change the type of an existing object
 
@NikiC That's quite of what I'm suggesting. Change the type if permissible.
and obviously the new type must be a subtype
 
@bwoebi But what if the user adds a string to it afterwards?
 
@NikiC then it throws
ah
wait
 
IMHO that would need internal copy-on-write behaviour (or rather, copy before write)
 
@NikiC yes, then it throws.
 
12:12 PM
@bwoebi to clarify, you only want to do this if no type parameter is given?
 
@NikiC This is my main concern, but I'm not restricting it yet to other scenarios.
 
@bwoebi I don't think changing the class of an object post construction can fly
 
I mean, you call a function array_keys: array<string|int> - and pass that to something expecting ints: array_sum(array<int>)
 
arrays are a different case than objects
For arrays something like this can work because they are by-val
 
whether array or MyCustomCollection
 
12:16 PM
that is, array_sum gets a different array (even if it might internally use the same backing storage)
 
was just trying to illustrate, sorry about the array
MyCollection->keys(): MyCollection<int|string> and sumCollection(MyCollection<int>)
that's what I was talking about
I just ended up not passing any string keys to the collection ... so how can I sum these?
will I be able to cast that?
What's the way to go for that conversion?
 
That seems like it ignores type information bwoebi, what you're suggestion would be:

MyCollection<int>|MyCollection<string> not MyCollection<int|string>
 
right
Or rather, you would have an explicit key type
Passing that directly to sumCollection() implies that you already know in advance that you only have integer keys, so you would type that accordingly
 
@MarkR I was actually talking about an union, not unique key types
 
And if you don't know in advance, then you'd have to check that. Say through $collection->cast<T>() if you like
 
12:24 PM
@NikiC yeah, that's my main gripe - the library returns me some explicit type like int|string - I know that it actually is only ever ints and want to forward that
I don't want to have to cast and convert around just because types
If it's compatible (as per the underlying storage) it should just work
 
Ah sorry, were you using the template params to represent key types rather than value types?
 
@NikiC Currently you can have function foo(): A | B and function bar(A) - and do bar(foo()) and it won't complain as long as foo actually returns an A - why wouldn't I be able to do that with generics?
 
@NikiC will PHP generics support typehints like in Java: List<? extends SomeClass> or more general List<?> ?
 
Other languages do require you to be compile-time sound, but PHP doesn't. PHP is known for runtime asserting whether a value (independently of its source type (which might be an union...)) is matching the current type.
 
12:40 PM
With func<MyCollection<A|B>>(new MyCollection<A>);

Let's say it worked on A, because func expects A|B it might do something like try adding a B to the collection, which would be allowed by its contract but not by the type given.
 
with func defined as function func<T>(T) you mean?
 
Changing A|B to A would seem to violate covariance because the type is being tightened from the original contract
 
Well, that wouldn't be allowed because A|B is not subtype of A
@MarkR right. That's what I'm saying:
40 mins ago, by bwoebi
(if permissible means: subset of the current type and not colliding with existing properties)
I.e. only if the tightening would invalidate internal type assumptions
 
What circumstances would it not invalidate them?
 
well ... if the object has: class Foo<T = int|string> { public array<T> $a = [1, "a"]; } - Then you cannot pass it to Foo<int>, but if it were class Foo<T = int|string> { public array<T> $a = [1, 2]; }, then you could pass it to Foo<int>
 
12:54 PM
errrr $this->values[$index] = $value;
 
1:07 PM
@MarkR that's why you need to properly type your properties then, use array<T>
 
That breaks encapsulation though. The external interface shouldn't care how it's handled internally. Maybe it's a typed property, maybe it's instanceof, or mixed. I'm not sure how you can achieve what you're asking for without breaking at least one element.
 
1:28 PM
@MarkR And it doesn't have to. It just has to assume that the internal state is maxing its bounds. I.e. shifting the responsibility onto the generic class
 
How would you ever read from it?
 
@MarkR what do you mean?
 
Collection<A|B> might have a get(): T method. If you did an implicit cast to Collection<A>, even if it only contained A at the time, there's no guarantees that it wont return a B, because the type of the actual object itself allows it.
 
@MarkR I'm suggesting to actually change the type
so that this guarantee definitely holds
 
Cloning the object in the process?
 
1:33 PM
No, changing it
 
What if it was used elsewhere? Would it suddenly change type?
 
@MarkR yes.
Where's the problem?
 
Passive casting changing an objects type that might be 50 lines higher in the code? Leonidas would kick you down a well.
 
@MarkR You mean Liskov?
@MarkR and yes.
 
and what about if it was used later on, would it magically change back?
 
1:41 PM
@MarkR no. That would be a violation as you can pass the objects forward, to everywhere
 
Maybe I'm missunderstanding, but:

$x = new Collection<string|int>();

func_expecting_collection_int($x);
func_expecting_collection_string($x); // boom?
func_expecting_collection_int_or_string($x); // boom?
 
@PeeHaa Can't wait to hear this! Just landed in Miami an hour ago. When I get home I will check it out!
 
@MarkR correct
 
That makes absolutely no sense IMHO.
If it were a byval object that was validated once as part of being passed as a parameter maybe, but a byref?
 
@MarkR where's the problem? by passing it to an int-expecting function you are clearly declaring it to be an int collection ... so why would you then continue and pass it to a string collection?
 
1:55 PM
Because it's integer or string, you said it could accept both. If you only want it to accept one it needs to be re-assigned.
 
@bwoebi better to use union type logic here. string|int is not subtype of int or string. But if create two different collections (one with int and one with string) and method that accepts string|int then it will work.
 
Because it's gone through what should be a passive operation of being passed as a parameter, it's now decided it's a completely different type?
 
@MarkR The use case is not when I say that it accepts both, but when I get a collection which happens to accept both and want to do something with it.
 
So let's say I instantiate MyCollection<string|int>("foo"); where __construct(T $dummy)... and every time I perform some operation I assign $this->dummy to the end of $this->items.
You've just changed the type of the object in flight, rendering my entire constructor type check invalid.
Now maybe you could detect that if I had private T $dummy, but I shouldn't have to.
 
2:16 PM
@MarkR Well, my whole point is revolving about that check private T $dummy
if you use generics, then ensure it's sound with internal types
 
Weren't you arguing an hour ago that types should be optional?
No offence intended in any way, I'm just debating the technicalities
 
Has anyone here installed dovecot for a pop3 server on ubuntu correctly?
It's so important.
 
nobody has ever installed a mail server properly in the entire history of mail servers and installing things
4
 
@JoeWatkins lol
 
that's what devops are for, you outsource that to someone else, who also doesn't know what they are doing, so that you have someone to blame when it all goes wrong ...
 
2:28 PM
@JoeWatkins isn't the instructions to flip around 1000 toggles based on obscure 10 year old mailing list posts and see what sticks?
i believe the definition of devops forbids outsourcing the ops concern and only doing the dev ;) there is still need for actual sysadmins :D
 
I call my sysadmins devops, like I'll cc devops in a sysadmins@ email ... they keep trying to explain the difference ...
I guess I don't really care what they think their job description is, what it actually is, is "everything I don't want to do" ...
 
@JoeWatkins I thought maybe it's better to know what I'm doing! If I figure it out I can make a Gmail! lol
I've installed SMTP server correctly. It uses sasl authentication
 
I long since decided not to bother anymore... mailgun for outgoing, gsuite for incoming
 
i love mailgun, but their insistence not allow me to pay to get co-located on an IP with other "trustworthy" people annoys me whenever my random mailgun server gets blacklisted by an ISP
 
We send a few hundred thousand with mailgun, have our own IP as far as I know
 
2:33 PM
yeah that makes sense if you send that many, but if you are below 100k mails per week, they don't allow you to do that
this is why i like postmark. they charge 10 times the price per mail than others and that instantly makes their IPs extremely trustworthy :)
 
Interesting, their website says 5000 per month
 
hm, when i asked them 2 years ago it was 100k per week
 
Doubt we send anywhere close to that many per week.
 
2:57 PM
 
Really need that /php namespace ;D
 
i vote to rename php8s class to WeakerMap sarcasm
 
WeakMapReal
 
php owns the globals namespace
 
I understand, even if it's a bad decision nowadays considering you expect everything above to own everything below
i.e. the PHP ends up owning every single namespace, user namespaces included
 
3:13 PM
I'm not clear on how that interplays with PECL as well, is it considered part of "PHP" in that context?
There's definitely plenty of scope for foot shooting either way :-/
 
@MarkR *claims the laravel namespace for the PHP project*
 
Java got it right IMHO, the java.* packages
 
We definitely document (in the manual at least) a claim on the namespace PHP, but do we (officially or otherwise) say the same for the global namespace?
 
@MarkR well java had namespaces since its first version, so they had to answer the question at the point where it was solvable :)
 
@salathe unofficially, yes ;)
It's kind of obvious when all of PHP declares everything in the global namespace and all of (*) userland declares everything in namespaces
(*) details may be wrong
 
3:21 PM
Personally I'd be absolutely in favour of aliasing everything into /php and then removing everything from the root namespace in PHP 10
 
PECL extensions are a bit of a gray area, as a lot of those are not namespaced either
 
@beberlei I can't subscribe to the notion that it's inherently unsolvable because of a poor decision made 10 years ago.... I don't think dumping everything in the root namespace is catastrophic... I just think it's dumb.
 
@NikiC lol may be wrong :P
 
(The original design decision, not the people following it)
 
@MarkR its a fact of life that you cannot go back and re-do everything just because it came out dumb, since the cost of doing so is higher, even though the cost of keeping it is also very high (think NULL terminated strings in C). arguing that it is simple to just do this and burn everything else down makes you argument look weak, because you discard the notion thats just not that easy instead of acknowledging it allows one to make the assumption that you haven't thought this through.
 
3:28 PM
I just moved 300 classes into a new namespace using PHPStorm. It took me 5 seconds.
 
that's nice for you, but phpstorm is prohibitavely expensive for users not living in western countries, leaving 50%+ of php developers out of your equation
 
Hi
thanks
 
Fortunately many other tools exist that are completely free, as well as Nikic proposing an officially supported tool straight from internals.
and personally I'd rather fix bad decisions sooner, rather than later. Fix it now and it's pain for as long as it takes to run a converter, don't fix it and you have to eat 20 to 30 years of the consequences.
 
3:43 PM
if someone else clones the php.net site, and runs the php web server inside of the folder, does /manual/en/install.php throw a "Not Found" error message? not sure if it's just me or if it's a bug. I just cloned the site using git clone http://git.php.net/repository/web/php.git php.net, then did php -S 10.0.37.151:8080 .router.php
or is the install page not included in the git repo...?
 
guessing here, but probably to run a different php file you can't include a router script. Try running it without the .router.php and it should be possible to run the install
 
I will be so happy if someone moves all Php classes and types into logical namespaces like Php\Type\String, Php\Stream\{Wrapper, Filter}, Php\FileSystem\{File, DirectoryIterator}, etc...to prevent global space pollution. So please count my vote too )) /cc @MarkR
 
@pmmaga It's not an install script, it's this page
 
ohhh
 
I would assume you need to build the docs first @Tiffany
 
3:56 PM
2 down, 70 more needed @lisachenko :D
 
@MarkR ouch )
 
@DaveRandom I was wondering that as well, :S I hope that's the reason
 
since the docs updated regularly, and you logically wouldn't need to redeploy the entire site when only the docs are rebuilt
I don't actually know though
!!summon @salathe
 
Didn't work... did you sacrifice a goat?
 
I thought it was a dove
 
4:04 PM
I think it's a dove for business hours only, a goat for all other times.
 
all... is someone available to check something?
0
Q: PHP SQL Concat issue

DarkSoulCheers, I want to concat multiple rows to one column Right now, my output is CaseID Name Number Register date filename Actions 2 John Doe 3/2020 2020-01-20 test1.pdf delete 2 John Doe 3/2020 2020-01-20 test2.pdf delete 3 J...

 
you've already linked it 35 minutes ago
 
all day I have tried to fix it :( and nothing worked..
 
it's not our responsibility
 
I just need to be guided to the right point.. isn't about responsibility.. is a small project for school
 
4:07 PM
my point is be patient
 
I'll try, but is pretty annoying because I don't know how to resolve it
 
A conference im signing up for wants a company name... i'm self employed, do you think if I put Room 11 anyone would notice? :P
 
bet you it's printed on the badge
 
@MarkR Either don't write anything, or write the name of your Ltd down? I often write up "Xdebug" now
also... I've just wasted 3 hours on trying to figure out why my code wasn't working, and it turned out there was a spurious \0 character messing up an array key :-(
 
at least it wasn't a semi-colon?
 
4:15 PM
Go doesn't want semi colons. I do add them all over the ffing place though. C and PHP are too ingrained :-)
 
On the topic of style... this genuinely made my soul ache reddit.com/r/ProgrammerHumor/comments/eqwbli/just_dont
 
4:33 PM
@cmb Ah yeah indeed, I thought it would have been updated in between but oh well
@Tiffany Okay okay, if/when you do remember to close it :)
 
@Girgias I will
(then I forget)
 
Hahah
 
@Tiffany the website git repo only contains a very small subset of the manual, just a couple pages to get you started (github.com/php/web-php/tree/master/manual). You should do a full docs build and symlink/copy the files into the manual/en/ directory.
 
@salathe alright, thanks
 
This is not really a doc bug but can we change the description of php.ini settings in stable releases? bugs.php.net/bug.php?id=79080
 
cmb
4:49 PM
@Girgias if they are wrong, we should
 
Okay okay, I'll maybe do that when I get back home
But what's the best way to have multiple versions of PHP locally?
Just have branches?
 
I've found docker to be the most effective method
 
I am talking about php-src
 
As in run multiple branches at once?
 
Well it's more for a bugfix
With the whole merge up and push in git
 
4:56 PM
@Girgias One clone, and just change branches when you need to w/merge
 
Okay, so I will need to pull the PHP 7.3 and 7.4 branches onto my machine lol
I only have master currently
 
how did you manage not to clone everything?!
 
cmb
@Girgias git worktree ?
 
--single-branch ?
 
Also @Derick how much do you hate me if I assign to you all the bugs related to the date/time extension
Well I maybe have them? Just never tried to check them out tbh
@cmb That creates a subfolder right?
 
cmb
5:00 PM
you can tell which folder to create
 
Just making sure that it does that, I'll maybe do that then
 
assign away...
many of them won't be bugs
 
Well you can always close them, I have no clue about the expected behaviour of the date extension :P
Should I close the old XDebug bugs btw @Derick? bugs.php.net/…
 
NO work today
 
I wish I could turn off that category. I don't even look at it, as bugs should go to bugs.xdebug.org
 
5:11 PM
@SalOrozco NO. Work today.
 
yes
What do you guys use to document an applications UI
 
cmb
@Girgias you have to tell git the path, e.g.: git worktree add ../php-src-7.4 PHP-7.4
 
Huh, okay
 
@Girgias I've closed them all. Feel free to close all of them with "If this is Xdebug related, please file a bug report at bugs.xdebug.org (but only if you use a supported version of PHP and Xdebug)"
 
@Derick okay :) I just realised there are 192 bugs related to date time
Some are docs some are featuer requests
 
5:20 PM
Please don't assign them unless you've verified them
 
I read them quickly but some are pretty ambigous as to wheater its a doc bug or a bug in the extension
 
5:33 PM
only took me like... ten days... but finally got the docs running locally, lol
 
\o/
 
with shared/mounted folder for phpstorm on virtualbox/debian
 
cmb
@Tiffany \o/ (but see second half of "Use PhD to build the documentation" on doc.php.net/tutorial/local-setup.php)
 
@cmb Or better, git-new-workdir
It supports checking out the same branch in multiple directories
 
user10141648
https://stackoverflow.com/questions/30414860/how-can-i-define-a-route-differently-if-parameter-is-not-integer

How do I do this when I don't use a framework like laravel
$router->get('users/delete/{id}', 'UsersController@delete');
 
5:46 PM
Use a routing framework on its own, Symfony has one, or Nikic/Fast-Route
 
cmb
@NikiC thanks, could have needed that in the past – and will likely miss in the future, since it doesn't seem to be available on Windows.
 
morns
 
6:30 PM
@MarkR yes, obviously, for the outside user. But IF you are adding generics to your class, well then properly type it.
 
6:45 PM
@bwoebi are native arrays even getting genericified?
 
 
1 hour later…
8:13 PM
@NikiC How focussed are you on the generics implementation for PHP 8? I started working on it (making slow progress). But if you're taking care of it, there's not really a point for me to continue.
 
@MarkR I was assuming that, yes
 
Interesting, I'd not seen that indication yet. I had assumed array would have stayed as mixed due to the huge amount of internal functions which operated on it.
 
@MarkR As Nikita noted before, for arrays, being by-value, we can actually do run-time assertions on them
 
Typed properties without typed arrays never made sense to me. I don't tend to buy coffee without the sugar.
 
and change the type as needed @MarkR
well, they aren't going to have a real type … their type is the sum of everything they contain at a given moment
 
8:18 PM
array_push etc would presumably have to be modified to deal with it, or alternative versions added that accepted template args?
 
echo 'Starting a session<br>';
session_start();

if(isset($_COOKIE[session_name()])) {
echo 'Session COOKIE is set.<br>';
echo 'Session destroyed.<br>';
session_unset();
setcookie(session_name(), '', time() - 3900);
session_destroy();
}

if(isset($_COOKIE[session_name()])) {
echo 'COOKIE IS STILL SET';
}
Why is the last if condition true ?
 
@user123456789 Because $_COOKIE has nothing to do with set_cooke()
 
@MarkR well, yes, everything that takes arrays by ref … but that change should be transparent and not affect current behavior
 
@Sherif Can you please explain? $_COOKIE is the superglobal the stores the cookies right
 
I think that would be considered very odd behaviour having a type changed based on what was assigned in it.
 
8:20 PM
@user123456789 setcookie() simply sets an HTTP response header. It doesn't modify the $_COOKIE superglobal. This is documented. Just like session_destroy() does not modify the $_SESSION superglobal.
 
Would that mean you could do $arr[] = 'string'; on an array<int> and it transmutes into array<int|string> ?
 
@MarkR if permissible by the types … if you have public array<int> $foo; you cannot do $obj->foo[] = "string";
 
But when I check the cookies in my browser after running this script, I still see the session cookie that I destroyed
 
but we are not going to define anything like new array<int>(1, 2, 3);
 
@user123456789 The cookie parameters must be identical in order to destroy it on the client, also documented. See php.net/session-destroy
 
8:23 PM
the generics on arrays are going to be an assertion on its contents at the time the type is checked @MarkR
 
So how would I destroy it ?
 
55 secs ago, by Sherif
@user123456789 The cookie parameters must be identical in order to destroy it on the client, also documented. See http://php.net/session-destroy
 
Interesting. I think I'll have to wait and see, I hadn't noticed generic based arrays in the test cases, it's possible I have missed them.
 
@MarkR It's not yet there.
 
How would anything using a userland callback work?
 
8:25 PM
@MarkR exempli gratia?
 
@user123456789 No it's not.
 
Anything which takes an array in byref, or containing a value which is a reference, could modify that value within the context of a callback, rendering at-parameter type checking invalid, I would think?
 
@user123456789

> Cookies must be deleted with the same parameters as they were set with. If the value argument is an empty string, or FALSE, and all other arguments match a previous call to setcookie, then the cookie with the specified name will be deleted from the remote client. This is internally achieved by setting value to 'deleted' and expiration time to one year in past.

(See **Common Pitfalls** under setcookie documentation)[http://php.net/setcookie#refsect1-function.setcookie-notes]
 
It sounds like what you're suggesting is an O(n) check at each call?
 
@MarkR the boundary for at parameter checking is the function signature - currently. I mean, function foo(int &$bar) { $bar = "abc"; } suffers the same issue
@MarkR no, we're going to need to count the types present (or maybe do an one-time O(n) count the first type the array gets type-asserted)
 
8:28 PM
alright I give up on SO markdown
 
I see two options there, the first would be an array of added types alongside the map data, the second would be iterating over every element of the array at each call for O(n)
 
yeah, the former
the latter is just not viable
 
So:

$arr = [ 1, 2, 3];
func_expecting_array_int($arr);

$arr[] = 'abc'; // boom?
 
no
 
I bring up that example because you mentioned the first time it gets type asserted, so if some constraint was set at that point something following it would not play nice
 
8:33 PM
@MarkR not for arrays
 
@Jasny-ArnoldDaniels I plan to work on generics this week and will see then whether to continue or not
I'm at something of a refactoring bottleneck right now where it's hard to make progress without changing all the things at once
 
what exactly?
 
Ok, I'll ask again in a week or so
 
@bwoebi Making things use github.com/nikic/php-src/blob/…
Basically zend_class_entry* should become zend_class_reference* and zend_string* should become zend_packed_name_reference.
 
oh, that sounds like a bigger change
 
8:45 PM
That looks like a handy place to keep a cache of already-tested type checks.
 
@NikiC Why is that needed? Why isn't zend_type_list args added to zend_class_entry? (which is what I'm doing)
 
@Jasny-ArnoldDaniels how do you handle the case where class Collection<T> is used twice, as Collection<User> and as Collection<Product>?
 
@Jasny-ArnoldDaniels to not duplicate a class entry for each instantiation (i.e. new Foo<SomeType> is going to create a new class ref)
 
^ that's how I was thinking it would be done when discussing it with Joe, end up with fully bound permutations. Expensive as the # of template args goes up though
 
Yes, I copy the whole class entry.
I was thinking that these could be registered and re-used. Wasn't really at the point of optimizing it all.
 
9:02 PM
It's not really a question of optimization, but of which generics model you use
The three main models are type erasure (Java), reification (C#) and monomorphization (C++). I'm heading for reification, and it sounds like you are doing monomorphization.
 
And there will only ever be one zend_class_reference for a particular class + set of generic types ?
 
@NikiC (had to do some quick reading on the subject :p)
Indeed, my approach falls under monomorphization.
Are there other benefits of reification over monomorphization, beyond being more memory efficient?
 
9:18 PM
@Jasny-ArnoldDaniels you could create instances of classes with runtime types e.g. new MyCollection<$barType> … full monomorphization would sort of forbid that
(or you'd have to runtime create new class entries)
And class entries are not refcounted (class aliases are refcounted, but not usage in objects) - so they would leak
 
9:32 PM
I guess... I planned to register them, so it would 'leak' anyway. Would the number of different values for $barType ever be big enough that this would cause a real issue? I mean, it's limited to the number of classes and internal types that you have.
I kind of get why reification is better, but it seems so much more complicated to implement than monomorphization.
 
9:47 PM
Are the parameter types currently included in the opcache type optimizations?
 
IIRC yes
Return types are not however
 
10:07 PM
@Jasny-ArnoldDaniels Well… once you start allowing $a instanceof T (i.e. usage within opcodes), you need to also duplicate the opcodes if monomorphized
 
10:24 PM
@bwoebi I don't think that would be necessary. Can't you use late static binding for that?
 
@Jasny-ArnoldDaniels there would be probably workable workarounds for it, yes
 
11:04 PM
Ok so this is almost a PHP question - almost because the service I'm building is built on PHP.
Earlier this week I was trying to figure out the best way to verify a user is a user without relying on technology that's easily overcome or a payment gateway. My new creative solution is to give the user an option. Pay a small $2.99 fee, connect 3 or more open auth/open id providers. (Facebook, Twitter, Gmail, Yahoo, StackExchange), or if they come from a "cart" they don't need to any of that. I was also wondering about adding "uploading drivers license" or verify phone numbers or something.
Originally I was just gonna ask everyone to add a credit card - banking on the wonderful work Banks should be doing to verify identity... With being selective on what types of cards I'll accept to add.
The fear is that users will be like "hell no!" and go migrate somewhere else. I feel like my creative solution fixes a little bit of the problem or something that throws the problem down the line a few years.
Question: Do you think this idea has any merit?
And what are your favorite open id/ open auth/log in with systems? I say 3 because if I just do one than someone can easily create an account. If it's 3, then I get some more information that I can use later in an automated system to "test" and "see" if the user is consistent with spam accounts etc.
 
If you just need some basic verification; use SMS.
If you need full KYC, don't do it yourself! There are way too many things you need to take care of. (especially considering privacy). We use https://onfido.com
 
@Jasny-ArnoldDaniels How much does that cost?
I assume it's per verification.
 
11:22 PM
@JustinKaz Sorry, I don't know the exact pricing. I do know it's per verification.
 
I suppose I can use that and pass the cost to the user - only after their account has been flagged for suspicious activity.
 

« first day (3383 days earlier)      last day (1548 days later) »