« first day (4240 days earlier)      last day (691 days later) » 

12:09 AM
@ramsey @Derick I had a quick look. The first argument of uenum_openCharStringsEnumeration is stored as is, so you can not put it on the heap.
From the doc : String pointers from 0..count-1 must not be null. Do not free or modify either the string array or the characters it points to until this object has been destroyed with uenum_close.
 
I lied. I guess I'll look at it tonight ;-)

I tried doing `units = (const char **) emalloc(sizeof(char *) * TOTAL_CAPACITY);`, but since I have defined units as `const char *units[TOTAL_CAPACITY]`, it won't let me do that. How do I define units so that I can allocate it on the stack properly?
 
const char **units;
 
ah
I was trying const char *units... I need to go learn pointers
 
@ramsey But I think you should use something else. Because if you do that you'll need to free the units, but I don't find anything inside icu to get this pointer back so that you can free it :-/
 
That built properly this time, without segfault or memory leaks, though. It returned the array I expected
 
12:23 AM
Yep, but if you run it with valgrind or use emalloc instead of malloc you'll see that one block was not properly free
 
Hmm. I am running with valgrind, but maybe I'm not using the right args
 
@ramsey use emalloc instead of malloc (after including php.h) you should see it.
 
I have it set up to run tests with valgrind, I think: github.com/ramsey/ecma_intl/runs/…
 
@ramsey I ran it with and without valgrind on your docker image and both report me the leak.
USE_ZEND_ALLOC=0 valgrind --tool=memcheck --leak-check=yes php -d extension=modules/ecma_intl.so tests/functions/supportedValuesOf-unit-001.phpt
or just run it without valgrind Zend MM will report it.
 
Doh! I forgot to set USE_ZEND_ALLOC=0 in the docker image
oh, but I think run-tests is supposed to do that for you, if you use -m
I see it now. I'm not sure why clion wasn't showing me that output. Maybe it's on stderr vs. stdout, or something like that?
I also don't see it in the GitHub actions run
 
12:36 AM
If I run it using -m I don't see it neither, but to be honest I don't know how -m works. It was not available when I started playing with PHP so I do it the old ugly way !
 
:-)
 
Remove the -m for the moment and try to always use ZendMM allocation functions, it should report it to you.
 
yeah, I see it
 
Good
 
@Pierrick I'll keep tinkering with it tomorrow. Thanks for your help!
 
1:03 AM
@Pierrick Actually, I fiddled with it some more and fixed the memory leak. I'm not exactly excited about the solution, but I think this is the only way to do it given how the ICU library works. github.com/ramsey/ecma_intl/commit/…
 
1:17 AM
@ramsey Yes it fixes it :-) You can also now allocate it on the heap with this solution ! And you weren't supposed to rest ?
 
 
6 hours later…
6:54 AM
Hi guys,
in PHP I can do as Typescript
$foo && bar() ?
run bar only if $foo === true ?
 
7:44 AM
yes
 
 
2 hours later…
9:42 AM
ok but the returned value is ? a boolean not the of bar() right ?
 
cmb
9:55 AM
you can use $foo ?:: bar() instead; if you want to check whether $foo is null (not falsey in general), use $foo ?? bar()
nope; disregard
 
 
1 hour later…
11:01 AM
hey i am using zlib.deflate stream filter and after creating a tar it tar file is fine but it dosent contains all the expected files, do you have any idea why would that be happening?
 
11:55 AM
morns
 
 
1 hour later…
12:57 PM
@cmb mmm
 
1:19 PM
@BruceOverflow the ?: operator is like a short if-else statement. It’s the same as if you wrote:
&& is a logical operator that means “and.” If the left side is truthy AND the right side is truthy, then the expression returns true
We say “truthy” because any value that is not one of the following evaluates to true. All of the following evaluate to false: false, null, 0 (the number zero), '0' (string of the character zero), or empty string
 
1:37 PM
I know, I would like: "echo $foo ? get();"
but is not possible
 
You can do echo $foo ?: get();
 
1:49 PM
get 1 not hello
 
cmb
you could do if ($foo) echo get();
 
yep, but I not would like to use if
 
2:26 PM
You get 1 because when using it as a shorthand, if the left side is truthy, it gets returned. If it’s falsy, the right side is returned. echo true converts boolean true to a printable value, which is 1
Maybe what you want is something more like this:
$foo ?: echo get();
Oops . Strike that it won’t work
You’d have to do !$foo ?: echo get(); which makes no sense when reading the code
But this would work: $foo ? echo get() : null
But I think you’re better off using an if statement, since it’s easier to determine intent when reading the code
 
cmb
2:48 PM
@ramsey ACK
otherwise echo $foo ? get() : null
 
ok thanks
 
 
5 hours later…
7:40 PM
Syntaxes, or syntaces?
 
8:01 PM
Former
 
8:16 PM
You're no fun.
wiki.php.net/rfc/auto-capture-closure - How do folks feel about the change to arrow functions included here? Safe to include or scope-creepy?
(It makes the auto-capture a bit smarter and thus more narrow, at the risk of some false negatives in edge cases that probably don't come up.)
 
8:38 PM
Does anyone see the need to use Virtalbox for local development? Since I switched to Docker I can't seem to fully understand the ins and outs of it and is kinda a nightmare sometimes
 
I can't recall the last time I installed much less used VBox.
 
I used that a lot because it helped me mirror my production env which was a Linux VPS with CentOs distro. It was great because I could develop on local and push to prod with minimal change
Now I'm torn in between of going back to something that worked for me (albeit being pretty old tool) or continue my battle with Docker
Don't even get me started on Windows WSL, can't understand anything about it
 
9:33 PM
WSL is love. WSL is life.
 
Is there any advantage to using WSL compared using dual boot in windows?
Other than the dual booting itself
 
9:50 PM
You can use them simultaneously, including easily interacting between both systems
 
10:27 PM
Has WSL's IO speeds improved? When I tried years ago, it was so bad that I couldn't bring myself to compile software on it...
@Crell I'm against, but not like, die on a hill against.
But, partly this is because the way references are implemented sucks :/
Being able to call by reference at the call site was rightly removed -- only functions which were intended to be by-reference should have permitted that -- but sadly they made the mistake of not allowing it even when it is passed by reference.
 
@LeviMorrison The whole RFC, or the arrow-function change in particular? @ArnaudLeBlanc was asking if we should push that change off to its own RFC (or just patch) or not. I don't have a strong preference.
 
@LeviMorrison It depends how you run it. If you're accessing files on windows from it, it's really quite slow. If you're accessing files on the EXT4 volume it's practically native.
I run all my dev straight from the WSL2 drive
 

« first day (4240 days earlier)      last day (691 days later) »