« first day (4363 days earlier)      last day (579 days later) » 

3:13 AM
GBP is the lowest I've ever seen x_x
The lowest it's been since 1985... wow
 
 
7 hours later…
10:22 AM
@Tiffany how do you render the XHTML docs locally again?
 
10:39 AM
Got it php ../phd/render.php -d ../base/.manual.xml -P PHP -f xhtml
 
11:29 AM
Morning All
 
Would it be a big change to allow use array as myalias;?
So builtin types, not only class names
 
11:43 AM
Yes, as array is a keyword
 
11:55 AM
@Girgias Does it matter for yacc? You'd hardcode the builtin types in the parser, array, string, int, float, bool, object.
 
@OlleHärstedt No only array is a keyword
Because of array() syntax construct
 
Hmmm
Still
%token T_ARRAY_CAST "'(array)'"
It's hard-coded for the type cast, so could use same thing.
 
12:11 PM
Morning All
 
https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L424
Add hard-coded values here ^
Guess I could give it a go later
No, maybe wrong place
Na ja
 
12:53 PM
@cmb I didn't quite get what you meant on the type declaration rewrite PR
Should I basically move most of it to the introduction?
 
1:04 PM
@bwoebi yeah, I saw. Looks quite amazing the progress.
nicely done!
 
cmb
@Girgias Yes, please.
 
1:45 PM
what is wrong with this code ??
$route = '/users/{id}/view';
$reqUri = 'users/{.*}/view';
$reqUri = str_replace("/", '\\/', $reqUri);

i want test is pass if it matches when url called something like this users/1/view .

my problem is when url call users/1 it passes ...
echo preg_match("/$reqUri/", $route);
 
2:16 PM
@AbdirahmanTusbahle Trying to convert a (effectively user input) URI into a regex seems like a bad idea to me. At the very least you should be using preg_quote() to ensure it's properly escaped.
I'm fairly certain most routers do things the other way around (convert programmer defined routes to regexes, then test those against the URI).
Have you looked at existing routers? For example: https://github.com/nikic/FastRoute (which I believe many other routers are based on)
 
3:01 PM
FastRoute is good, and Symfony's router component is also good. I wouldn't let performance dictate your choice; look at the features and other things. For instance, does FastRoute have the ability to generate a URL for a given route (reverse routing) or provide route names these days? I haven't followed it in years so I don't know, but I think those features are decently valuable and I'm pretty sure Symfony's has them.
 
 
1 hour later…
4:06 PM
@Girgias I refer to this so much doc.php.net/tutorial/local-setup.php
even as reference
well, that's what "refer" means...
 
@Tiffany lol
 
4:55 PM
Btw, allowing use int as meter; should probably go together with use int|float as numeric;
In the same RFC, that is
Is there already one?
If not, can I help write one?
 
5:24 PM
Are these "use" clauses per file, or per "execution" ?
If you do this, you probable should extend this to a "type alias" RFC.
 
@cmb I've now discussed this with zeriyoshi and added the ext/random deprecations: wiki.php.net/rfc/… /cc @Girgias
 
JRL
@OlleHärstedt are you looking at all this for part of an RFC? Do you have a link I can look at?
 
cmb
@OlleHärstedt use int as meter might not be the best idea – edition.cnn.com/TECH/space/9909/30/mars.metric.02
 
JRL
@cmb That kind of usage and its potential for bugs is touched on in my document for PHP developers on how to use operator overloading for my failed RFC
 
cmb
@TimWolla thanks!
 
5:30 PM
@Derick Per file, I guess, since that's how use works now. Right...?
@Derick Yeah, but then it gets complicated T_T
 
@cmb Right, it should be metre ;-)
 
@JRL Can't find an RFC, only a mail from the mailing list, one year ago: externals.io/message/112209#112215
@cmb Weeeeell, the point with "proper" type alias is to avoid such problems, since then meter won't type-cast to int automatically, only by force.
 
JRL
> In this case, integers and floats are missing an important dimension: the currency. It's unsafe to assume the intended currency of a particular integer or float. That's in fact the whole point of the Money class, to supplement the integer and float types because they don't capture this information.
 
@JRL Where? Currency is fixed-point numbers anyway, shouldn't use float.
 
JRL
@OlleHärstedt it's a quote from Rule 3 on the link i sent above, which touches on how the int and float types should not be used in code for numbers associated with units
 
5:34 PM
Ah ok
 
JRL
would use int as meter; use int as foot; function foo(meter $bar) {} produce a TypeError if a foot value was sent? would it just interpret foo(5) as being in meters?
 
cmb
@JRL ACK (besides that I wouldn't use floats for monetary calculations)
 
JRL
ha, neither would i :)
 
@JRL 5 is an int in that example, so in a tight type system it would not compile. But I won't swear it's how it works in OCaml/Haskell... :d
Lemme check that
 
JRL
@OlleHärstedt so how would you call it? foo( (meter)5 ); ?
 
5:39 PM
@JRL No, you need a "factory" function that returns a type meter from an int
 
JRL
i wonder how many unit conversion bugs would never be written in the first place if i can get some version of operator overloads passed
numbers that have associated units is probably the use case that is most widespread
 
Sadly, this compiles: https://paste.centos.org/view/2b39e247
I think you have to wrap it in a module an make the type "abstract" from the outside. Lemme check...
 
JRL
@OlleHärstedt ah, so it's sort of a functional programming way to accomplish value objects without having to have objects, but still having to have about the same number of function definitions and calls
 
@JRL Yeah. Here's a working example with error message included: paste.centos.org/view/7e5e4eb3
sig ... end is the module signature, which hides the "real" type of t
But now you can't use Meter.t as an int either, so. Trade-off. :)
 
JRL
right
this is... one of the major arguments i presented in operator overloads for why its useful
 
5:47 PM
Yeah? In the RFC? :)
 
JRL
to make objects more interchangeable with int and float types if the correct logic is provided
still wouldn't pass an int type check obviously
yep. in the RFC
dunno if @Danack is going to focus on that use case for v2 of the RFC
lol, sorry Danack, didn't mean to summon you. shouldn't have pinged.
 
just coincidence......was just popping by.....but big headache right now.
 
Ibuprofen, dark room, silence...
@JRL Just FYI, you can also do let (+) = <plus thingies for meter> in a module. Then the weird syntax Meter.(m1 + m2) <-- Applies Meter scope inside parenthesis. Or let open Meter in .... :)
So to start an RFC I must first ask for "karma"...?
 
JRL
wiki karma, yeah
although
writing it first in github on markdown is useful too
wiki karma is only really needed when you want it to go into the "official" discussion stage before voting
 
@JRL Would that still get feedback from important voters?
 
JRL
5:59 PM
@OlleHärstedt that's a total crapshoot that doesnt at all depend on where your RFC lives
i covered that a bit in my "how to make an RFC" reddit post
 
Hmmmmmmmm
 
JRL
getting feedback from voters is something you cant at all depend on the mailing list for
 
/me reading
 
JRL
but you also can't ignore the mailing list
 
Maybe it's best to just have a small PR, to provoke a reaction?
 
6:16 PM
> make: *** No rule to make target '/home/olle/kod/php-src/main/php_stdint.h', needed by 'ext/opcache/ZendAccelerator.lo'. Stop.
?
Fresh install of php-src needed?
 
no, just:
make clean
rm ext/opcache/jit/zend_jit_x86.c
rm -rf configure
./vcsclean
./buildconf --force
 
Awesome, thank you :D
 
7:00 PM
Hmmm, where's the lexer?
language scanner?
Is there a configure switch to turn off all extensions?
 
JRL
the lex definition file?
 
@JRL Where? Or what?
> Fatal error: Uncaught TypeError: foo(): Argument #1 ($x) must be of type int, int given
:O
 
7:28 PM
phpdbg doesn't show use-statements?
 
7:56 PM
Hm, maybe I can open a stackoverflow question, actually ^^
 
8:26 PM
I am working on old application. We have a large table around 9 gb of data. I need to copy data from one column to another column in same table.
I alredy have Adding new column and renmaing and deleting the old colimn.
So I want to create a script with while loop that will select 100k records at once and update it. This should keep going until the whole table is done.
I am not relay sure how to do it and if I can use update select in this case. So far I have:
$sql_query = "SELECT `id`, `errors` FROM tabele;";
$result = $db_conn->query($sql_query);
while ($row = $result->fetch_assoc()) {

    if (null !== $row['errors']) {
        $update_query = sprintf("UPDATE table SET `errors_new`= %s WHERE `id` = %d;", $row['errors'], $row['id']);
        $db_conn->query($update_query);
    }
}
 
JRL
why not do it in a single query?
no php necessary
 
@JRL That will lock the tablle and we don't want that to happen
 
JRL
wait, this is like a live production, high traffic situation?
 
Yes
 
JRL
if that's the case, why is this being given to a developer instead of a DBA?
well
i guess i can just answer your question
 
8:30 PM
We don't have that
 
JRL
well you clearly need it
doing this sort of stuff through code is always going to be a bit iffy, too many things can go wrong
but i would use a queue
and push items into the queue in one process
and pull them out in another
with that amount of data
 
MySQL 8.0.28+ supports lockless column renaming.
 
JRL
seems like two tables
unless tabele and table is a typo
 
So unless you need to have both columns for deployment reasons, you can just rename the column and you're done.
 
@TimWolla No it is same table we want to modify one column. and we are usig mariadb 3.3 at the moment
@JRL What do you mean using and pushing into a queue?
 
JRL
8:36 PM
well if this is on the same table, then i would do what tim said and rename the column
 
@JRL That only works without downtime in MySQL 8 and only if the application does not need both columns (e.g. for a staggered deployment).
 
@JRL We can't because we ne to alter tinyint to bigint
 
JRL
oh, missed the the mariadb comment
 
But really, if downtime is unacceptable you should likely have a replication setup and a proper DBA.
 
JRL
yeah
that's what i was getting at originally
if downtime is totally unacceptable for any amount of time
you need a qualified DBA, there's no other option really
 
8:39 PM
@TimWolla I am not the boss unfortunatly. At the moment we are al developers
 
JRL
yeah well, that doesnt change reality
i would never take personal responsibility for guaranteeing something like that in a live environment when i know im not qualified
 
Frankly, if you don't know how to do it properly without downtime, you should bite the bullet and do it in a locking fashion. Having garbage data in your production database is going to be worse than some downtime.
You can change the type and rename with a single (blocking) alter table, that shouldn't be too bad for 9 GB of data on properly configured MySQLd with appropriate hardware.
 
I get that. But about my question Can I select and update 100k at once and so on? For now I have to do that so no choice
@TimWolla Sorry That is not what i am searching at the moment
 
I'm not going to help you shoot yourself in the foot, especially since we're lacking critical information about your environment.
 
JRL
same
this will get you fired/disciplined/sued
dont want to help that
 
8:46 PM
Ok and thanks. I needed help with script not with enviroment
 
JRL
the fact that you think that worries me. i wish you luck, and hope it ends well.
 
9:07 PM
@luffy You should know better how to listen what experienced people say. Best you can do in this very moment is to find out team lead, senior developer, project manager, tell them what you're advised and ask for opinion/suggestion.
 
 
1 hour later…
10:21 PM
@luffy you're asking for help, free of charge. We're volunteers. You get the help people are willing to give.
@luffy I get that you're frustrated at not receiving the help you wanted, but the problem you're asking help for isn't an easy one, and it's the type of problem that could cause serious ramifications, for you, your team, the person offering help. And it's the kind of problem people don't want on their conscience if they give advice that breaks something. You need some who has speciality with the problem.
 
@cmb Okay will do that tmr :)
@TimWolla The deprecation of the functions looks pretty early? Is ext-random provided on PECL so that one can use it prior to 8.2?
 
@Girgias There is a userland polyfill: github.com/arokettu/php-random-polyfill.
 
Right, I personally don't mind, but not sure how most other voters will feel about this
 
You miss every shot you don't take :-) If it becomes apparent that this is not liked, we can drop it.
 
That's also true
Maybe it's just my short tags PTSD talking
 
10:35 PM
Generally I'd say that needing a seedable engine should be a rare thing. random_int should be the default choice (and I've attempted to explain that).
 
Yeah
 
In the application I maintain at work, I've completely removed any uses of mt_* in favor of random_int.
We don't need the seeding and random_int is fast enough. Now I sleep well knowing that all the randomness comes from the CSPRNG.
 
Haha, I totally understand it, and it does make more sense to use random_int() :)
 
JRL
is there a fast option left if you don't need CSPRNG?
rand() was approximately 15 times faster than random_int()
and PRNG is fine for situations in which you need a number that has the characteristics of a random distribution, but doesn't need to be irreversible/CS
(an example would be sampling from a normal distribution when selecting a characteristic of a simulated model)
 
@JRL Sure, the OO API. In fact it added some fast engines in the first place.
 
JRL
10:45 PM
nice :)
 
Mt19937 really should be considered "legacy" with PHP 8.2. Its quality is not great, it requires a metric ton of RAM and it's also not fast.
3v4l.org/m52t9#v8.2rc1 - While it appears as if Mt19937 is the fastest, however it only generates half the number of bits per call compared to the others.
 
JRL
side channel, the way that computers collect entropy to generate these numbers is kinda nuts
it depends both on the OS and the hardware, but it can come from things like device timings, voltage variations, or even single-bit error correction events from radiation like cosmic rays hitting your RAM, which is fascinating.
 
11:24 PM
> Research has shown that a computer with 4GB of memory has a 96% chance of having a random “bit flip” every three days.
o_O
(googled "cosmic ray bit flip" I typed "cosmic ray" and Google suggested the "bit flip" portion)
 
JRL
thats the reason that space computers are so "old" and "outdated". they generally have very, very small memory compared to modern consumer hardware.
but they can operate perfectly fine in hundreds (or even thousands) of times the radiation as earth's surface
they are also built out of specially tested "hardened" components instead of off the shelf stuff
so NASA and the like can't benefit from the economies of scale that drop your RAM down to pennies per MB
every time they want to put RAM in a spacecraft it's basically special order production
 

« first day (4363 days earlier)      last day (579 days later) »