« first day (3936 days earlier)      last day (995 days later) » 

12:38 AM
run sql query get no result ・ PDO DBlib ・ #81295
 
1:06 AM
@Trowski btw - you can probably archive/delete/nuke from orbit github.com/trowski/fiber-rfc now. just remembered it from my open issues.
 
 
2 hours later…
3:32 AM
A question about square bracket matching ・ *Regular Expressions ・ #81296
 
3:46 AM
@Danack Yeah, thanks, removed.
 
 
3 hours later…
6:35 AM
Hello, everybody! Can you give me cudnn_ops_infer64_8.dll file? this is NVIDIA site, but my google account is banded. my skype: live:.cid.4e33278116661f51. thanks for your help.
I'm developing ML app. Help me...
Hello, beberlei!
 
6:54 AM
moin
 
Good morning.
 
7:50 AM
Incorrect __toString() return for internal deprecated functions ・ Reflection related ・ #81297
 
English question, is "at" correct in the following sentence?
> the approximate price (per active install) was calculated at 32,000 Rial on average.
 
8:25 AM
@Shafizadeh yup
 
8:38 AM
thx
 
9:13 AM
Core dump on PHP 8.1 ・ Reproducible crash ・ #81298
 
9:48 AM
password_hash() documentation is missing PHP 8 changes ・ Documentation problem ・ #81299
 
10:20 AM
I have a quick question. I am trying to test my error handler function with unittests.
I want to create situation with E_RECOVERABLE_ERROR.
For example with E_USER_ERROR I can just do trigger_error("Fatal message from eUserError", E_USER_ERROR);
How I can do this for E_RECOVERABLE_ERROR. I tried with Closure but it does not create error (at least in unit tests).
 
The only thing which creates an E_RECOVERABLE_ERROR is converting an object to an integer when it doesn't support it
 
hi, i have a small problem...i have a string whit numbers...but to calculate the number shoud be number right? because i never get the correct result
if i make this:
TotalsGeral = Number(TotalsGeral)
the output console is NaN
 
@Girgias So something like $object = (object) $array; (int)$object should do it?
 
No, because most objects will use the default handler which handles this
 
posted on July 24, 2021

Announcement time!!! You remember Dr. Lobster, right? That old webcomic I did with Michael Buonauro? The one from the early 2000s? Of course you do. Well, Tuesday the 27th is the 20th anniversary of the release of our theme song, carefully and beautifully crafted by Evil Adam: The Ballad of Dr.... [read more]

 
10:27 AM
I think how you can get one is by using a GMP object and casting it to (bool) ?
 
@Danack it seems to be harder than I would have though, have you found anything? also what/where is it for?
 
@Girgias $x = gmp_mul(2,12);
    if ($x) echo "x";
 
You know you can just try it instead of pinging me...
 
Thanks
 
11:08 AM
Morning
 
@Tiffany yo
 
11:18 AM
@DaveRandom yeah, mark suggested amazon.co.uk/Adastra-Stereo-Amplifier-Bluetooth-Player/dp/… - it's for me and my room...my previous one apparently short-circuited on the hottest day. Half the inputs are dead, and the ones that work are pretty distorted.
 
11:32 AM
@MateKocsis as you seem to have a working PHD setup, can you check that github.com/php/phd/pull/33 works as intended?
 
cmb
@Girgias We need to work on the test suite. Would be good to have a test for this.
 
Right, I just have no clue how to add tests for this, I'll try to have a look, but currently in renovating :-/
 
cmb
11:57 AM
@Girgias There is a small test suite; doesn't look hard to add further tests. However, I have not managed to run it yet; there is an issue regarding the SQLite indexing; possibly, that was never supported.
 
12:09 PM
@Girgias it almost works well for me, I found that it doesn't work well for a few simple nullable parameter types (e.g. only "?"is rendered in case of the first param of IntlDateFormatter::__construct()). I also had a few comments of the PR
 
Hi!, I'm sorry to distrubing you all, but I have a problem with my code. can you please look at here? stackoverflow.com/questions/68529471/… I'm sorry because I'm a newbie in here :(
 
cmb
mixing HTML and PHP causes cancer to the eye ;)
 
PHP is a template engine, it's OK to mix to some extent.
was*
 
Using a separate template engine is just mixing HTML and PHP with extra steps... and no intellisense or static analysis
 
I;m sorry :(
but, my problem already solved :) thank you!
 
12:19 PM
FYI just a trip, avoid using the foreach (...) : syntax, almost no-one understands it
 
use something that is frontend adequate, sooner or later the domain logic starts to leak in templates
 
I always use the alternative syntax in HTML ;)
@ln-s Funny how this happens even when using Twig or similar...
 
Because you are supposed to use something which is frontend exclusively and just use PHP as an API
 
"supposed to"
 
plus you add separation of concerns to your work which is also a big plus
 
12:21 PM
Maybe CI can be used to enforce only some PHP constructs in view files...
 
thanks for the information. I'm just a newbie but I got my first project, I should explore more :D
 
Split API / front end has only really been a thing recently, PHP is way, way older than that style
 
Supposed to, i.e: I'm not going to put a gun against your head for you to do it
 
my employer developed their own templating engine as a C extension, but I think it was developed before Twig was around or at least stable... if they had the choice, they would use Twig now
 
"my employer developed their own templating engine as a C extension" - Rasmus...?
 
12:22 PM
so many client sites are built on the internal templating engine though, switching off of it would be near-impossible
 
leave old as it is, use new paradigm for new stuff
customer won't pay for stuff that you would like to have
@MarkR Yes I know
 
@ln-s aye
 
Are you with the guys of Phalcon ? @Tiffany
 
cmb
@OlleHärstedt oh, right, it's not that bad; still, I'd use short echo tags, different formatting, and avoid the inline styles
 
@ln-s narp
caps
 
12:36 PM
This is a bit strange

https://3v4l.org/M5oXf

If you observe carefully, the first and last hashes are exactly the same
I suspect engine optimizations of some sort, but need confirmation
 
That's normal behaviour for spl_object_hash(). Particularly, "Once the object is destroyed, its hash may be reused for other objects." (from docs).
 
Where did the destruction took place tho
I'm not changing the internal items array at all, so I'm a bit confused
as to where the destruction takes place
 
You clone them in current().
It's the cloned objects that you're getting the hashes of, and are being destroyed.
 
But where tho, I just iterate through them I never implicitly destroyed any of them, this is what I don't get
 
12:52 PM
@salathe hope you're doing well :)
 
The clones are getting destroyed not the stdClass you created. You get the cloned object in your loop block and then, because it is a clone not referenced from anything else, it gets destroyed.
You can see the hashes alternate because they only ever exist long enough to output the hash
 
@Tiffany Doing fine, thanks. I'm dipping my toes into giving some two-pennies-worth in docs-related PRs, but baby steps there.
 
Reviews are always appreciated :p
 
12:59 PM
@salathe it's appreciated <3
 
 
2 hours later…
2:34 PM
Heredocs closing identifiers ・ Reproducible crash ・ #81300
 
user4717133
2:46 PM
There is some way to obtain the name of the variable passed to the method (not the name of the parameter in the method), they recommended me with reflection but they did not give me any more clues on how to implement it correctly, it seems to me that reflection is quite extensive and I don't know which one is it the correct way to implement or is there another way apart from reflection?
 
There is at present no interface that means "a reflection object that supports attributes." I... don't think all of them do? Or maybe I'm wrong. Does that seem like something worth adding? Or if it is available on all reflection objects, shouldn't that be added to the Reflector interface?
@FranciscoNúñez-TodoPoderoso I don't think reflection can do that. MAYBE you could generate a backtrace and dig back through that, but backtraces are hella slow, so I'd recommend against it.
 
user4717133
ok gracias
 
What are you trying to do?
 
@CharlesSprayberry I get it now, thanks for clarification
 
 
1 hour later…
4:10 PM
This class is littered with places where asymmetric visibility would be better than readonly... :-(
 
 
1 hour later…
5:21 PM
@Crell I have a lot of classes where the opposite is true ^^
 
5:37 PM
When using zend_get_property_info_for_slot, which should I guard against for both the object and slot arguments? I'm currently using:

#if PHP_VERSION_ID >= 80100

if (ce->type != ZEND_INTERNAL_CLASS) {
zend_property_info *info = zend_get_typed_property_info_for_slot(Z_OBJ_P(*struc), tmp_val);
if (info && info->flags & ZEND_ACC_READONLY) {
But I still get a segfault, for:
#6  0x00007ffff44b171a in xdebug_var_export_xml_node (struc=0x7fffffff9ce0, name=0x555556f24bb0, node=0x555556f1ebb0, options=0x555556f1ea90, level=0) at /home/derick/dev/php/derickr-xdebug/src/lib/var_export_xml.c:635
635							zend_property_info *info = zend_get_typed_property_info_for_slot(Z_OBJ_P(*struc), tmp_val);
(gdb) printzv *struc
[0x7fffffff9d60] (refcount=2) object(A) #1
Properties     Hash(1)[0x7ffff42781e0]: {
      [0] "\0*\0aa" => [0x7ffff4264940] indirect: [0x7ffff427b078] long: 302
Any idea @JoeWatkins or @NikiC?
It looks like my "slot" zval is not part of the properties...
97	static inline zend_property_info *zend_get_property_info_for_slot(zend_object *obj, zval *slot)
98	{
99		zend_property_info **table = obj->ce->properties_info_table;
100		intptr_t prop_num = slot - obj->properties_table;
101		ZEND_ASSERT(prop_num >= 0 && prop_num < obj->ce->default_properties_count);
102		return table[prop_num];
103	}
104
105	/* Helper for cases where we're only interested in property info of typed properties. */
(gdb) p obj->ce->properties_info_table
$10 = (struct _zend_property_info **) 0x408c0370
 
@Crell What class?
 
@ln-s An attribute/reflection class I'm working on. Basically, attribute class that can also take values from reflection on the object that it's annotating. But a readonly promoted property can never be settable again after the constructor; logically impossible.
 
5:59 PM
@Derick I'm missing context, where is tmp_val from ?
also, I can't find the code you're referencing, is it public yet ?
 
            /* Adding normal properties */
#if PHP_VERSION_ID >= 70400
            myht = xdebug_objdebug_pp(struc);
#else
            myht = xdebug_objdebug_pp(struc, &is_temp);
#endif
            if (myht) {
                zval *tmp_val;

                xdebug_zend_hash_apply_protection_begin(myht);

                ZEND_HASH_FOREACH_KEY_VAL_IND(myht, num, key, tmp_val) {
                    int flags = XDEBUG_OBJECT_ITEM_TYPE_PROPERTY;

#if PHP_VERSION_ID >= 80100
                    if (ce->type != ZEND_INTERNAL_CLASS && Z_TYPE_P(tmp_val) == IS_INDIRECT) {
*struc is the object's zval
(and this code is now slightly modified, the IS_INDIRECT is wrong)
 
yeah that's wrong
xdebug_objdebug_pp
does that call debug info, and is that causing a temp table to be returned, and so tmp_val is not within properties_table bounds possibly ?
 
That's a distinct possibility
The PHP code is:
<?php
class A extends ArrayIterator
{
    protected $aa;
    public function __construct()
    {
        $this->aa = 302;
        parent::__construct(array( 2, 3, 4, 5));
    }
}

$a = new A();
var_dump($a); // put breakpoint here
xdebug_objdebug_pp pretty much does:
return zend_get_properties_for(&dzval, ZEND_PROP_PURPOSE_VAR_EXPORT);
 
that rebuilds the dynamic table, and that is what is returned
 
so... what do I do :-)
 
6:10 PM
well without changing the code too much because I'm not sure I understand the whole context, drop the for_slot for a normal property info fetch (silent) zend_get_property_info
info will be NULL for dynamic and ZEND_WRONG_PROPERTY_INFO for otherwise invalid
 
I don't udnerstand what you mean by "drop the for_slot for a normal property"...
I think I might have a workaround.
 
else it should be usable and correct, I think ... you may need to set fake_scope in eg, but tests should solve that ...
> drop the for_slot for a normal property info fetch
ie, use zend_get_property_info
 
oh, duh
 
(which uses it's name, which you have in myht)
 
yeah
ah, duh --- the key is the mangled one. I need to unmangle it too.
 
6:20 PM
ah yeah, mangling is so annoying
 
sorry guys, but what is "mangling"? (I did a quick search here and it made some sense, but I'd prefer understanding it from your pov)
 
gah, and zend_unmangle returns a char *, and zend_get_propery_info wants a zstring
@FlávioHeleno The "trick" that PHP uses to allow for protected and private variables to be stored in the same symbol table as public properties. It prefixes the real name with \0*\0 or \0classname\0
 
oh, thank you @Derick!
it does that so it can use a single symbol table? (or rather have less columns/properties in such symbol table?)
 
@Derick okay, it's beginning to feel a bit hacky now, but whatever, zend_get_unmangled_property_name will return the property name which is interned, so use zend_string_init_interned and it won't allocate a new zend_string anyway ... so not terribly inefficient ...
just a lot of jumping through hoops ...
 
do I still zend_String_release this init_interned string?
 
6:28 PM
not strictly, but the code will read nicer if you do, and if some bad software does something (like runkit or something), you'll deal with that better if you release ...
 
hmm, I know have zend_get_property_info return NULL :-S
 
is dynamic property ?
 
it's possible, but I thought checking for ZEND_WRONG_PROPERTY_INFO would solve that
 
it should return NULL for dynamic property name
ZEND_WRONG_PROPERTY_INFO should be for inaccessible, but you probably want everything and want to set fake scope (or it's already set, sorry missing context) ... I guess you'll have some test covering this so you'll find out on the first test run ...
 
checking for NULL makes it no longer crash an old test, but ket's see if it sees the proprety info now
Ah, ik looks like it!
test pass... time to make dinner
thanks!
 
6:32 PM
okay cool, yw
 
\o/
 
zend_string_init will allocate though, the property name is interned in a lot of cases so you can avoid those allocations ... even dynamic properties have their keys interned in most cases ...
const char *zend_get_unmangled_property_name(const zend_string *mangled_prop)
will save some of those char*s (of hide them, but it will read nicer whatever)
doing behind the scenes things with properties is always unpretty though ...
 
there are no more char* casts though... but will switch to using zend_string_init_interned
 
also zend_get_unmangled_property_name would mean a strlen, so swings and roundabouts, probably best use the one you're using ...
 
 
2 hours later…
8:47 PM
(gdb) shell cat test.php
<?php
declare(strict_types=1);

class Foo {

	public function bar(int $a) : int {
		var_dump(func_get_args());

		return $a;
	}

	public function bar(float $a) : float {
		var_dump(func_get_args());

		return $a;
	}

	public function bar(string $a) : string {
		var_dump(func_get_args());

		return $a;
	}
}

$foo = new Foo;
$foo->bar("string");

$foo->bar(42);

$foo->bar(4.2);
?>
(gdb) r
Starting program: /opt/src/php-src/sapi/cli/php test.php
warning: Probes-based dynamic linker interface failed.
method overloading is a pandoras box ... let's just not do it ...
ever ...
 
:O would be a nice feature though
 
Learn C++ if you want overloading.
 
I prefer sticking with PHP/C :) it's good enough <3
 
You'd be great in advertizing... "$THING! It's good enough!"
 
@JoeWatkins There's one bit where although method overloading is one possible solution, the same problem could be solved with an inline generic declaration: phpopendocs.com/rfc_codex/…
 
8:54 PM
hahaha
 
generics don't look like a realistic thing, I can't imagine an implementation I would vote for
 
Don't worry, everyone else would vote for them so we didn't get chased after by people with pitchforks :P
 
let me be more specific, I can't imagine an implementation dmitry wouldn't veto
 
Thank gawd those aren't a thing
 
haha, they are
 
9:01 PM
Okay, let me rephrase, short of throwing internals into political turmoil by someone trying to exercise a veto over what is literally the single most wanted PHP feature to ever (not) exist.. :P
 
@MarkR I left my Yorkshire at home today... It's been a long day.
 
@StatikStasis 3 cups when you get back matey. You'll feel better.
 
I needed it today.
 
we don't own dmitry, if something is voted in and he is unwilling to do the work to make it acceptable, it isn't going in ... if it seriously harms perf or complexity, it just isn't happening, no matter the result of a vote ...
I can't really imagine an impl of generics (that is sufficiently useful) and does not harm both perf and complexity in a serious, road blocking way ...
 
@JoeWatkins For the ignorant, points at self , what is Dmitry's role exactly?
 
9:05 PM
opcache/jit/optimizer
 
Is that just some part of the code base only he works on?
 
jit
 
I see
 
if in some future, we collectively own a developer - we don't own nikita either - and we can put someone to work on it, for very large chunks of time ... then maybe the game changes a little ... but right now, this is the situation we're in ...
even if we did "own" nikita, and could determine what he worked on today, it wouldn't make sense to put him on this task, because it would be basically all he could do, and at a guess it would take several months to make a good start, meanwhile everything else would stop ... as usual it comes down to a lack of resources that we can actually control ...
 
Honestly if you polled 1000 developers on if they'd prefer generics or JIT, 950 of them would choose generics.
 
9:18 PM
too late
 
Speaking of new features, how much would it cost us for you to spend some time looking at a RFCable version of scalar methods / properties?
 
also, I'm not sure where you get these numbers from, I have a feeling they are made up ... in this imaginary future, where we control all the time of at least one developer, we would have to test your assertion that this really is the most wanted thing in some way, or else it wouldn't make sense to put them to work on it either ...
 
Really? Generics being the most wanted feature is a meme at this point.
 
\o/
 
cmb
@MarkR actually, 950 might not know either concept ;)
 
9:27 PM
I don't really pay attention that much to what people say on reddit or twitter ... everyone I've ever interacted with, through any medium, that was associated with PHP, doesn't even make up a sample big enough for me to make any judgements ... so I'm not sure how anyone can ...
I'm just thinking that if we did control the time of a developer or two, then things other than generics become worth talking about ... like a new streams layer, like an event loop, like new SAPIs that move away from (f)cgi, to name a few off the top of my head ...
 
If phpstorm can support like 99% use cases of generics, I'll be happy with that
 
do we want generics more than anything else, really ?? given a future where we can talk about generics as a real possibility, then other things seem more important to me ...
@MarkR I haven't seriously looked at this, I will in the next few days and come up with a number maybe ...
 
cmb
There are also a lot of minor things, like adding methods to the new opaque objects which replaced resources.
 
Or fixing "recent" additions
 
@JoeWatkins In terms of the highest value additions, yeah I think they're #1 without a doubt. Sadly IluTov didn't come through for us for 8.1 reddit.com/r/PHP/comments/o41juw/… - There's plenty of other things which would be nice, shapes, accessors etc, but even though those are powerful features, they'd have nowhere near the impact generics would.
 
9:38 PM
people can only see the stuff that fits in their heads......trying to explain stuff like that the current pecl ecosystem is a bit crap, and describing a whole set of changes that could be done to make it easier to install extensions is something people can't understand they want without doing a whole lot of thinking...
 
I don't even think it's a matter of engine support for the most part, but if PHP implements a standard for how they work, IDEs will have to follow it.
Scalar methods and properties would be another thing that is well up on a lot of people's wish lists. Of course a lot of that relates to arrays, which aren't typed.
 
JamesMon ・ *General Issues ・ #81301
 
10:24 PM
@Crell there are more, you can have e.g. import Something as string; and it will substitute $str->foo() calls with Something::foo($str). Or alternatively $str->foo(); calls foo($str).
unless that's also "unwrap" for you
For what it's worth, I like the import Something as string; approach as it will keep the scalar methods magic local to a single file (i.e. you have no scoping issues, or would have to fear to impact unrelated code …)
 
@JoeWatkins I get it- that's open source. Appreciate the info- was curious of some of the roles for many of the well known players.
Time for home- later all.
 
@JoeWatkins I think generics are pretty much #1 of the big milestones. Surely, there are smaller features, but of the big things we want, it's probably generics or built-in fiber support for internal functions. But generics will impact more people
 
@StatikStasis blog.krakjoe.ninja/2021/05/avoiding-busses.html is a worthwhile read
 
10:40 PM
@bwoebi I think that would be the optimal solution too, provided a default set was provided
 
10:53 PM
@MarkR what do you mean with default set?
Some internal class with a set of static string functions you can use? (and have to import?)
 
@bwoebi The ability to override makes sense, but I recon that 99% of people would b e perfectly happy with a php-src provided set, that is used if no other import is
 
@MarkR possibly yes, but I guess we should first introduce the import-thing and charter the php ecosystem for what APIs libraries provide before settling on our own?
 
I don't think creating our own would be that complex, clone JS if it comes to it. I think the number of people using custom implementations would be extremely limited.
But I feel like having to do several additional lines of import or declare statements at the top of every file to get what most similar languages provide by default, would be a miss-step.
As usual, the problem is going to be utf8 strings.
 
11:20 PM
I tried to figure out why PDO takes so long to connect to MySQL on Windows vs WSL2 and I have absolutely no idea
 
@Dharman are you connecting to 'localhost' ?
 
I tried localhost and 127.0.0.1, but it doesn't make any difference.
One way or another it connects via TCP on 127.0.0.1
I know there were problems with DNS on Windows 7 or earlier
 
not DNS per-se, but IPv6 attempted before falling back to IPv4 - stackoverflow.com/a/11667268/778719
but if you're connecting to 127.0.0.1 it shouldn't be that...
you could attempt to investigate with what's apparently the windows equivalent of strace - docs.microsoft.com/en-us/windows-hardware/drivers/debugger/…
 
Python: 0.0003s PHP: 0.0101s This means that it's not MariaDB settings
It has to be something to do with PHP
It's too late today to learn a new tool, but I will checkout this logger later
It would be nice if one could profile PHP source code
 
11:39 PM
it's annoying that intel keep making vtune harder to get - software.intel.com/content/www/us/en/develop/tools/oneapi/…
 
@MarkR I don't even know what utf-8 string handling should do … sometimes you want character wise… sometimes grapheme specific, sometimes grapheme clusters. there is no real "true" handling regarding to string splitting, string length measuring etc. So everthing really should just be byte-wise. The only thing where it's more or less clear is casing changing functions, which I would be fine to have the default tolower() and toupper() functions respecting unicode.
 
11:55 PM
@bwoebi imo there's only one long term around it and that's.... string<somekindastringtraits>
 
string<lengthable>
...because that is what you are implying :-P
 
string<bin> vs string<xxx> where xxx would determine characteristics such as length, substr behaviour etc, while still maintaining byval etc, and no spec would revert to string<bin>
 
user image
3
 
how about just fuck all that and new BinaryBuffer(), where it is not possible to specify a literal binary string because that makes no sense?
(I am fine with the idea of specifying a literal byte array)
string and byte[] and character[] are very different concepts and the sooner we stop pretending otherwise the better
micdrop
 

« first day (3936 days earlier)      last day (995 days later) »