« first day (4314 days earlier)      last day (624 days later) » 

12:27 AM
Hello
 
 
1 hour later…
 
2 hours later…
3:32 AM
@Sjon 3v4l.org is giving persistent oopsies.
 
 
4 hours later…
7:17 AM
@mickmackusa yes, I fixed it as soon as I saw your mail. Should be fixed
 
7:52 AM
Hey, do you guys know any client for PHP for dialogflow CX or I need to create my own? For ES version there is an official client but for CX there is only a few and PHP is not there ;/
 
8:33 AM
\o
 
 
1 hour later…
cmb
10:01 AM
 
10:59 AM
Emphasis on maybe. I don't have access to the main box to diagnose more, but that autoload path was a problem when trying to reproduce locally.
 
 
2 hours later…
12:51 PM
@JRL And both look wrong :P
 
1:03 PM
@MarkR Well, given that extension functions are included on a file-scope level, I think that's pretty okay.
 
For any type with methods, they're the same regardless of which file it's in. While I can see the flexibility, I don't think that overriding what the scalar methods of say an int or string on a per-file basis is going to be beneficial for the long run. If anything it would probably lead to intense fragmentation.
 
I think a fixed API is preferable is we can make it happen (both in terms of consistency and performance) but it's unrealistic to happen in a single RFC. I think if somebody could create an initial RFC that lays down the groundwork with a few uncontroversial functions that could be a good way to get started.
 
cmb
"with a few uncontroversial functions" – nothing is uncontroversial for internals :p
 
1:23 PM
the basic ones are easy, the real question is multibyte
"foo".length vs "foo".utf8Length
and I think the other ones we identified causing issues was array.push etc
 
foo.bytes.length :-)
 
Trying to put writing systems in a computer was a mistake. Behold, the ambiguity of is_numeric.
> I remember a major outage at a past job where a Java frontend validated something like 10.đź’Ż.1.1 as a valid IP and commited it to the source of truth.
8
 
1:39 PM
Indo-Arabic numerals or GTFO ?
 
@MarkR Yeah everything with references won't work, but I don't think we even want such an API. The only exception would be sorting for arrays, but I can live with sort being a function.
@cmb array keys() and values() would come to mind, but yes honestly that's about it :P
 
@Danack And that đź’Ż supports my "Indo-Arabic numerals or GTFO" position. Whatever that IP is being passed to is expecting ASCII and nothing else, so that should be validated using ASCII and nothing else.
And yeah, that's imperialistic AF, and I DGAF.
 
Actually, gtfo if you use Arabic numbers, allegedly:
 
@IluTov just return a copy
"just" being when the arguments start
 
1:44 PM
Shaeria numbers :D
 
@MarkR Pretty unnecessary for unshared arrays.
 
2:01 PM
@Danack I refuse to believe this is not parody.
also I am physically unable to listen to it for more than 30 seconds
 
@cmb Um, maybe? We'll see. I have no idea how it works internally. I just edit the content. :-)
 
@Danack bloody algebra al-jabr
 
If I had more energy, I would write a joke in the voice of Stewart Lee, mocking the need for a zero.
 
cmb
@FĂ©lixAdriyelGagnon-Grenier look at the lower right of the screen; it says "satire" :)
 
2:10 PM
@Danack That shit is comedy gold.
@cmb It's also very clearly stated in the channel description: """Nothing on this channel is real. Flagg is the fictional alter-ego of a liberal troll."""
 
Oh geez, 2 minutes in... "Al-jee-bra"
 
tbh, I grabbed the first link that looked good....and although I remember the outrage of arabic numerals being taught, I couldn't be bothered to look for an authoritative link.
 
2:35 PM
@cmb Make sure you read to the end where liberals think schools shouldn't be teaching about the big bang either.
 
cmb
@Sara I fully agree with not teaching a sitcom. ;)
@IluTov see github.com/php/php-src/commit/… (known issue)
 
2:53 PM
Jeez, whoever this guy is posting curl examples as spam really needs to get a life...
 
cmb
@Crell I wonder about the purpose. Is it about the SSL verification being disabled?
And I wonder how we could detect that spam.
 
No idea.
 
@Crell where's the drama?
 
@Danack Someone keeps posting snippets of curl utility functions to various docs pages in the curl section. All identical. We delete them, they come back. There's no obvious security hole in them, but they're at best useless.
 
any suggestions on this?
Aug 2 at 3:08, by Tiffany
different topic, on https://www.php.net/get-involved, #3 says "Filing and resolving bug reports at bugs.php.net" ... Github doesn't have an organization-level issue repository, how should this link be revised?
 
3:02 PM
What projects would we link to other than php-src and docs? (That we'd want drive-by contribution on.)
 
Eh web-php maybe?
 
I've been shilling doc-base and phd
 
Ah yes PhD exists
 
but I've seen that doc-base has received some love, so I need to see how much better it is
 
Do we want drive-bys on those?
 
3:04 PM
@cmb eyeroll YOU'RE in a hot, dense state.
 
Or just link to the organization, and let people figure out how to get to the appropriate issue link. If someone can't find how to submit an issue from the organization landing page, they wouldn't be able to submit a PR anyway.
 
@Crell probably not... the improvements needed for doc-base and phd will take a time investment
 
@Crell And if need be, we can improve the text shown here: github.com/php
 
the handy readme that Sara did is pretty useful
 
Indeed.
 
3:06 PM
and salathe, mainly Sara though
 
eh, that's rather interesting, not being aware of who Lemaitre is I'd have probably answered a reflexive "no" to the verbiage of teaching priest's ideas
 
I think just link to that org landing page and be done with it.
 
did you watch my talk? @Crell :P
(by chance) (I was reminded it exists last night)
 
I don't think so. Which one?
 
@FĂ©lixAdriyelGagnon-Grenier Right, but the point of that question is that we ALL have biases. It's not a conservatives-only problem.
I mean, I'd say a bias against religion in schools is a good one, but I'm a hippy commie socialist anarchist libtard
 
@Tiffany bookmarks
 
(warning: it is flawed, I didn't practice other than making the slides, and there are a few places I want to improve it... but it is my very first talk)
 
> Anyway, I don't like the idea of changing engine in favour of third-party extensions.
How can I argue against that? :|
 
@Girgias Sorry, just dropping in. What's the context
 
3:23 PM
Multiplication is assumed to be commutative
And it breaks if an extension (e.g. Matrix object) overloads the operator for something to be not commutative
Only affects when there are 3 operands or more
 
3:41 PM
@Girgias isn't the extension doing the bad thing in that case ? unless I miss something and I feel like I am, "multiplication is assumed to be commutative" is what everyone expects, how much sense does it make to change that from an extension, does modifying the engine to allow otherwise even make sense ?
 
@JoeWatkins Multiplication is rarely commutative
And I don't see why the extension is doing something bad here
PHP allows operator overloading for extensions
So it overloads the multiplication operation in the standard way and it's being bitten because PHP assumes it is commutative
 
@Girgias and that's what I didn't think about ... of course it isn't :D
okay so we're making a bad assumption
 
The assumption is valid for int and float
Which would be fine it extensions couldn't overload the operator
 
@Girgias it does, but it's not widely used or well developed, I would omit it from arguments ... that is what elicited that response from dmitry ... you're better to follow the line of argument that this is technically incorrect and leave out any mention of anything else ...
 
@Girgias What do you mean, rarely?
 
3:45 PM
tbh I'm a little confused now, why would opcache/ze make that assumption ...
 
@LeviMorrison rarely when talking about other vector spaces …
 
@LeviMorrison In the grand scheme of mathematical objects, multiplication is rarely commutative :)
@JoeWatkins It's not even OpCache (which would kinda make sense sometimes) but the actual VM, and I don't understand how it even gets to that reordering
 
dmitry mentioned the jit might make the same assumption ...
 
Yeah, I'll need to have a look at that, I know opcache doesn't because Nikita removed that assumption
 
@Girgias It gets to that reordering when emitting VM handlers. In zend_vm_set_opcode_handler_ex(). There zend_swap_operands() may be called.
 
3:50 PM
scribbles this down
 
the assumption that it's safe to swap them, is what I expect, at the instruction level the operation must be commutative, I think I understand the desire to avoid this assumption at the expression level, but I'm not sure it's so simple
we would need some higher level thing to allow a user to define how an expression works, operator overloading is not really the correct thing ... maybe ...
 
cmb
At the very least, we should document that possible operand swapping at phpinternalsbook.com/php7/classes_objects/….
 
4:30 PM
... huh this might be very basic; so I've started learning arabic on duolingo and like... how are right to left languages represented in strings? I guess bytes still start from the... "lower" (whatever that means) memory address then go up? how does it work with multibytes characters?
... do I even want to get in that rabbit's hole?
 
cmb
@FĂ©lixAdriyelGagnon-Grenier I think that is totally unrelated; actually, it would be an endianess issue. For instance, there is UTF-16BE and UTF-16LE.
 
JRL
5:16 PM
@LeviMorrison I covered that in my RFC a bit. Basically, the things that people here think of as "usually" and "always" being true about operators is really mostly just "properties of real numbers".
which is.... fine, if you can prevent operators from being used with anything except ints and floats
which of course you cant if PHP wants to continue supporting extensions
the one i still want to fix is the assumption that >, >= and <, <= are commutative
but that can't be fixed without updates to both opcache and JIT
the JIT part is the hard part of that tbh. comparisons get reduced to assembly for integers and such.
 
5:36 PM
tbh comparison is the most compelling one to constrain
even if you fix opcache and the JIT, it's desirable to not break sorting algorithms
with that said, PHP's comparison operators are a bit of a joke there, we have no ordered/unordered distinction like e.g. Rust
playing with Rust a bit has softened my stance on operator overloading
I would probably be happy with one interface per operator, except for comparison
 
JRL
interfaces dont work for operators
or operator overloads anyway
 
ah, right yes, I'd want something trait/typeclass-like rather
 
JRL
because you dont know if the types are combinable with each other from the interface
 
yeah
 
JRL
even magic interfaces like Stringable unfortunately... because that is the most requested change from userland for my operator overloads RFC, but it's impossible to do without introducing errors
 
cmb
5:42 PM
@Girgias You could quote from wiki.php.net/rfc/operator_overloading_gmp; e.g. "The operator overloading is exemplarily implemented for the GMP extension", and "Vector and matrix calculations". The relevant point is third-party extensions, but why ignore third-party extensions (the only bundled extension which uses operator overloading is GMP).
 
JRL
i mean... it's the only one that uses do_operation, but technically DateTime uses it for comparisons
it's just in Zend that's a different handler
from a user perspective though, those are both operator overloading
 
@Andrea I think in general, with operations in a maths world you should be able to canonicalize representations internally so that == is trivially true without extra overloading.
 
@cmb Oh that change was RFCed, nice that's good to know
 
cmb
@JRL oh, right; I focussed on do_operation only
 
JRL
@Andrea the issue isn't so much to make it so that A > B and B < A can produce different results (although there are some domains where they absolutely could). I ran into it when allowing for A and B to have different overloads of compare. The problem is then that the left-most overload is executed for everything in PHP except for >, in which case the right-most overload is executed.
This could actually come up in any extension which allows the compare handler to be delegated to a function which can be extended through class inheritance
though I don't think that is the case for any extension currently
for the record, when it comes to userspace comparison overloads, I'm in favor of exactly two functions: equals() and compareTo(). equals() would be optimistically checked first for ==, while compareTo() would be required to satisfy >, >=, ==, <, <=
with the normal -1, 0, 1 convention
 
5:56 PM
@JRL oof…
yeah equals and compareTo sound good
 
JRL
still doesn't help if they have different code for those functions though. we don't want half of the comparison functions to execute a different implementation if those overloads ever made it into userspace, which extensions absolutely could do right now
btw, that also requires the ZEND_UNCOMPARABLE define to be updated. right now it's == 1, because the entire engine assumes that all comparisons are done as < or <=
at least 80% of my test PR for the operator overloads RFC was dealing with this > and < issue. the code for everything else was pretty light.
and i still wasn't able to fix it entirely for JIT and OpCache, because i simply don't have all the necessary skills and experience
 
@cmb that is a tolerable rabbit's hole, thanks!
 
JRL
for some reason i could never figure out (though I didn't spend much time on), changing ZEND_UNCOMPARABLE broke comparisons that involved $var = INF;
in a different way from how it broke other things
 
6:19 PM
oh god
I just noticed I worked on my methods for primitive types idea in like… 2015
seven years ago…
 
@FĂ©lixAdriyelGagnon-Grenier The "reading direction" is a property of the Unicode character in question. See "Bidirectional class" here: compart.com/en/unicode/U+05DE
There's also special characters to override that, e.g.: en.wikipedia.org/wiki/Right-to-left_mark
 
6:54 PM
here's a sketch of what method aliases for php string functions could look like gist.github.com/hikari-no-yume/9f726970c7d8eb9f50b08a013ef57f3a
I hope the naming scheme is fairly intuitive
notice the explicit suffix for when something is particular to ASCII or to the C locale
also notice how, if you were to sort by the aliases I've given things, related functions would be grouped together
also notice how it makes certain gaps in the API obvious
 
JRL
7:19 PM
does hex2bin and bin2hex actually require the binary to be in byte chunks?
as the alias name implies?
 
What do you mean by byte chunks?
 
JRL
as in, does the number of bits in the string need to be divisible by 8
 
How would you create a string that has a number of bits that is not a multiple of 8?
 
JRL
hmmmm
 
I just want to convey it operates on the binary data, rather than on e.g. an ASCII representation of binary
 
JRL
7:23 PM
$var = (string)0b10010; ?
 
That is just equivalent to "18".
 
JRL
i wonder what that does actually
 
bindec('10010') == (string)0b10010
 
JRL
well that's true, lol
 
@TimWolla use a computer that has a 9 bit word.
 
7:24 PM
@Danack Can you tell me which museum I need to break into?
 
I would, except that searching for "Dec 10" does not bring up results for DEC computers.
 
JRL
@Andrea Locale is used in several places here. it'd need to be pretty clear what that word is meant to convey about the string interpretation to PHP devs in the documentation.
 
Also … are you positive that PHP runs on such a system?
 
I suspect not.
 
7:27 PM
@JRL sure; I'm using it as a suffix to indicate “follows the C locale rules” (as opposed to being bytewise, ASCII-based or something else)
 
JRL
even that, to the normal PHP dev, doesn't convey useful information
 
mostly it's a signal you shouldn't use it :p
I kinda wonder if I should exclude locale support entirely
modern apps should be using UTF-8 after all
though… then there's the problem of mbstring being its own special kind of ~garbage~
 
@Andrea The ASCII suffix is not completely accurate for trim(). It's not "ASCII", it's "Bytestring", i.e. it supports bytes > 0x7F which are not defined in ASCII.
 
@TimWolla yeah I was debating about that one myself. the thing is, the default trimmed characters are ASCII
 
The same is likely true for the ASCII suffixes. And str_split does not split on whitespace, but after X chars.
With chars = bytes.
 
JRL
7:31 PM
perhaps.... we actually shouldn't alias existing implementations, and instead use it as a way to retcon the string functions without breaking things...
 
@TimWolla oh you're right, thanks
 
JRL
string methods would be a greenfield
 
@JRL yeah I am considering that tbh
or maybe only alias the unproblematic stuff
 
Also I agree with JRL here. Just having an alias does not gain us anything.
 
JRL
even in that case... i'd personally say duplicating the implementation instead of aliasing might still be better, just so that we know that all string methods can be changed without BC breaks all the way back to PHP 3, lol
 
7:34 PM
I also don't want to have to deal with the named parameters mess that would ensue…
 
JRL
oh balls, i forgot about that. that's gonna be unavoidable though.
this is a 9.0 type thing, right? not next minor version?
 
so one of the problems is that if I add aliases/duplications for all the byte methods, someone will object with “but modern apps should use Unicode/UTF-8!”
oh, it could be the next minor, it's not a breaking change
I don't think we can ever get rid of the classic string APIs, they're too ubiquitous
 
@Andrea That sounds like PHP 6 to me.
 
so here's the thing about Unicode
naturally you might think “let's alias the mbstring methods too”
 
JRL
@Andrea that's why im saying greenfield. i'd prefer to have a bespoke set of methods than all the existing ones.
 
7:37 PM
problem: the mbstring functions are badly designed in general and also most string methods have no mbstring equivalent, for no particularly good reason
problem: the byte string functions are actually better than the mbstring for various tasks if you're dealing with UTF-8
problem: mbstring handles case conversion and case insensitivity wrong, which is one of the most important things people want “Unicode support” for
so you might say, ok let's do a clean UTF-8 string API for PHP, greenfield etc
 
JRL
wasn't unicode specifically designed so that a unicode implementation would by design treat ASCII as ASCII?
i forget this whole saga back from PHP 6
 
UTF-8 is designed to play well with software used to ASCII-like encodings, yes
problem with a clean new UTF-8 string API: we would have to rely on ICU. but that would be politically difficult to implement
I guarantee that if we add ICU as a dependency to php-src core, someone will complain it makes PHP more annoying to build for them
and it is also a pretty heavy/expensive dependency
 
JRL
expensive in what sense
 
I haven't checked but I think it takes much longer to build and is much larger (in terms of file size) than PHP itself
it's also written in C++…
 
JRL
but all of that are compile time performance issues for building the binary, right?
 
7:43 PM
yeah indeed, it'd be no problem at runtime
 
JRL
it wouldn't inherently slow down the built interpreter?
okay
 
also virtually any target you'd deploy PHP to probably already has at least one copy of ICU on it
it's a political problem not a technical one
I wish I hadn't given up on the UnicodeString extension project…
if I limit to just byte string methods…

hexToBytes, bytesToHex, fromByteValue, toByteValue, split, join, trimLeft, trimRight, trim, contains, startsWith, endsWith, replace, pad, repeat, compare, find, findFromEnd, substr
 
What about base64_encode/encode? That's also missing from your initial list.
 
yeah I was wanting to include those too, I'm surprised php doesn't have them in the string section?
 
"length" is missing, "pad" should likely also get padLeft/padRight for consistency; "join" is implode? I already find that confusing in Python.
Looking at that a little more, I'm not that sure I would make base64 (and by extension the hex encoding) a method on a (byte)string. That type of encoding should be standalone.
 
7:58 PM
yeah I guess so
so I guess it'd be:

split, join, trim, trimLeft, trimRight, contains, startsWith, endsWith, replace, pad, padLeft, padRight, repeat, compare, find, findFromEnd, substr
maybe chunk_split too (not sure what name, chunks?)
as for brand-new functions, I would want to add fromCharCodeUTF8, toCharCodeUTF8, validateUTF8, nextCharUTF8
we can trivially implement those without any scary dependencies and they're the basic primitives for working with UTF-8 IMO
validateUTF8 is just a convenience function
 
@Andrea mbstring is mostly garbage, but in fact has been good enough for virtually all use cases I had in the past
 
function validateUTF8(string $str): bool {
    for ($i = 0; $i < strlen($str); $i = $str->nextCharUTF8()) {
        if ($i === FALSE) {
            return FALSE;
        }
    }
    return TRUE;
}
@bwoebi yeah it's not useless, but I also don't want to encourage people to use it, it really needs replacing
 
@Andrea this really needs some sort of iterator, you don't want to attach state (char position) to string
 
@bwoebi oh oops sorry, I meant to write $i = $str->nextCharUTF8($i)
 
ah okay
 
8:10 PM
but yeah I'd want to add a convenient iterator too
 
@Andrea but preg_match("//u") will remain more performant…
 
@bwoebi haha, possibly :p
 
or preg_split("//u") to get an array of utf-8 chars…
I mean… you can add all these nice APIs… but it's kind of stupid if they're going to be much slower then other more obscure ways
 
oh hang on
split, join, trim, trimLeft, trimRight, contains, startsWith, endsWith, replace, pad, padLeft, padRight, repeat, compare, find, findFromEnd, substr

this list… I could easily UTF8-ify all of these
 
I still believe that join should rather be an Array method.
 
8:20 PM
split (by any UTF-8 character)
join (no change needed)
trim(Right/Left) (by any UTF-8 character)
contains, startsWith, endsWith (no change needed)
replace (no change needed)
pad(Left/Right) (??? not sure)
repeat (no change needed)
compare (uhh this can be easily utf-8'd but it's questionable what the benefit is)
find(FromEnd) (no change needed)
substr (controversial opinion: shouldn't be changed)
@TimWolla that's a popular opinion I think, but imo there's several ways to join an array depending on the kind of data in it, whereas there's only one meaning of “join” that makes sense for strings
also we could make ","->join($array) support an iterator for $array
 
Yes, that is what Python does. But I'm not sure I agree. It reads like Yoda conditions.
 
IMO it's just a question of what you're used to
another name could be ","->intersperse($array) but I think that fails my requirement of guessable names
it's not a very common word, even if it is perfect for this
I think I'd be willing to settle for $array->joinStrings(",")
hmm
padding doesn't really make sense on a codepoint basis, I think
so I'd skip that
oh, and split doesn't need any changes :p
 
8:38 PM
@Andrea Is that still the case since Alex took over and it's now a fork of the unmainted upstream? A lot (and I mean a lot) of mbstring has changed and loads of bugs seems to have been fixed
 
@Girgias good question, I'm not sure. it doesn't look like the API has changed much though
 
@Andrea User facing API is hard to change that's for sure
 
 
1 hour later…
9:58 PM
@cmb Without output suppression, there's even a helpful error message. :P Fixed the 8.1 build in github.com/php/php-src/pull/9279. 8.0 build still fails.
 
cmb
10:13 PM
@kelunik Ah, I'll have a look tomorrow.
Stance on libraries: minimal PHP needs to be compilable without any particular libs (sans libc etc.) So we would need to bundle ICU, which is unlikely to be a good idea.
 

« first day (4314 days earlier)      last day (624 days later) »