« first day (3814 days earlier)      last day (1131 days later) » 
00:00 - 23:0023:00 - 00:00

12:49 AM
that is going to mature real nice with a "re-architecting the solution" resolution in a few days
conference memes for years to come
 
 
3 hours later…
3:36 AM
@BrentRoose I'll still be around for at least an hour if you have a few minutes.
 
4:25 AM
@Trowski still here?
 
Yep
 
Ah nice!
I can help you out now :)
 
Add AC_MSG_ERROR(["Host CPU is $host_cpu"]) after the AS_CASE([$host_cpu], ...) section you were editing.
 
got it, hang on
So this message should shown up during make, right?
configure: error: "Host CPU is arm"
there it is :)
 
@BrentRoose That's annoying, Apple didn't provide a way to distinguish from 32-bit arm.
 
4:32 AM
Apple sometimes does those annoying things :p
 
I anticipated this was going to be the case and had a commit ready.
Pull the latest commits and try building again.
 
latest on master?
Or a separate branch?
 
Yes, master.
 
looks like it works :)
 
Cool, thanks. :) Now we know fibers will build for everyone with shiny new Macs.
 
4:40 AM
Should I configure a stack size btw?
fiber
fiber.stack_size => 0 => 0
Like with the JIT that doesn't work if there's no memory configured?
 
You could play with the size and see if it blows up in weird ways.
0 means "use the default stack size"
 
What happens if you're doing things in a fiber that exeed the stack size?
 
Results in a stack overflow and the program crashes.
 
Ok, looking forward testing them out!
 
Because PHP's VM is iterative, that shouldn't come up.
 
4:47 AM
@Trowski Unless someone installs zend_execute_ex -- you tested this, right?
Does boost have anything for detecting stack overflow on these things, or is that totally something they ignore?
 
@LeviMorrison Yes, I'm aware. That's why the stack size is adjustable. I have yet to need to change it.
@LeviMorrison Boost is swapping stack pointers. The stack overflow detection is done with a guard page.
 
 
2 hours later…
7:10 AM
pdo_mysql function lastInsertId() return wrong. ・ PDO MySQL ・ #80908
 
8:09 AM
\o
 
8:39 AM
RIP I asked a question on codereview instead of softwareengineering
 
Unused variable causing further code in the function to stop executing. I am using PHP5.3.29. Are there any changes I need to make in php.ini to ignore such a variable?
 
@Exception PHP doesn't care about unused variables at all
 
lets see the code!
 
https://imgur.com/a/QeEcrJe
This image shows the code difference between older version of suitecrm and newer one. It is working fine on local/prod/dev but not on QA env.
Left side $result is the culprit
I logged $string before and after $result using suitecrm logging functionality but the after one is not working at all
I commented $result line and it started working..
 
9:02 AM
did you turn off error reporting?
 
9:13 AM
that line isn't just "an unused variable", it's a statement that calls a method
$focus->retrieve('bean_id');
presumably, there's an error being raised in that method
 
^ this
 
(also, holy shit! PHP 5.3? in 2021? you have my condolences)
 
@IMSoP LOL really
 
@IMSoP haha.. yeah! old legacy project
 
10:15 AM
@Crell I am afraid all the scenarios concerning "auto-capture" mentioned on the mail list, and already covered by this test: github.com/php/php-src/pull/6246/….
@Crell Let me know if there is a specific scenario you think we should cover on tests too.
 
 
2 hours later…
11:48 AM
This operator priority surprised me: 3v4l.org/U9I2I
 
@OndřejMirtes 3v4l.org/5ZJBA Not that I recommend it.
 
I don't write code like that anyway, it's just a test case in PHPStan that broke and inspecting the AST led me to this.
 
That's kind of crazy
 
lol
 
It's not that surprising if it was an assignment on a separate line: $val = fetch() && $i++ < 10;
But here in a while loop condition it's surprising.
 
11:52 AM
It still is, why would val be casted to true
then with and .. it doesn't
 
@ln-s It's not, the precedence is different. It's evaluated as while ($val = (fetch() && $i++ < 10)) {
 
I never use that keyword anyway, always && or & (in some situations)
 
And has lower precedence, so it's while (($val = fetch()) and ($i++ < 10)) {
 
Yes seems a bit strange that and (and) && have different precedences, again, I don't use "and" so this is rather strange to me
 
@ln-s Yeah, we disallow and/or in our code base simply because the precedence is confusing to a lot of people. But the semantics otherwise are completely the same as &&/||.
 
11:56 AM
I could have sworn and was the same as &&
The more you know
Jesus
 
cmb
I think and/or are perlisms, and have been used quite often in the early days of PHP (e.g. $db = mysqli_connect(…) or die("can't connect");).
 
12:15 PM
how do you feel about xor?
idk if I have ever actually used it in code that got commited
 
Same. Bitwise xor can make sense, although I do very little bitwise operations in PHP. As for `xor`, not sure if I've ever in my life wanted to express `$a &&
!$b || !$a && $b`.
 
XOR - "$a and $b are different"
 
@OndřejMirtes There are multiple falsy values. false xor null === false
But for bools, yeah.
 
I've moved my question from codereview to software engineering as I was suggested and now I'm getting downvoted :'( , RIP
 
Yeah, I use only booleans in conditions. No if (count($arr)) for me.
 
12:25 PM
Would vote for and or whatever to be removed
for you know, 9
 
1:03 PM
@yessure there's quite a lot to read there; I know it's tricky, but spending a bit more time editing it down to the key points might help get better responses
 
@IMSoP Okay I'll try to synthesize it!
 
needing multiple bullet points summarising what you're asking is also a bad sign for a pure Q&A site; it means each answer has to cover all those points
 
 
1 hour later…
2:23 PM
@NunoMaduro Ah, then we can answer to that question with exactly what will happen, and state that it is consistent with the existing behavior (since nothing in the patch changes how auto-capture works, it just flips it on).
 
Let's say I debug a script with phpdbg, how would I find the OP LINE in php's source code?

For example: TYPE_CHECK<64>
 
2:43 PM
Specifically TYPE_CHECK transpose to ZEND_TYPE_CHECK
phpdbg cuts off the ZEND_ for brevity
 
Ah good to know thanks Sara
 
The number in the aligators is the "extended_value" (a general purpose number field that can be used in opcodes. In the case of type check, it's probably signifying the actual type to check
Well no, maybe not. 64 doesn't name a single type
Oh, it gets pivoted into a type mask, neat.
So that's an is_string() call
 
The only place I see ZEND_TYPE_CHECK is here, but where does it comes from ?

ZEND_VM_HOT_NOCONST_HANDLER(123, ZEND_TYPE_CHECK, CONST|TMPVAR|CV, ANY, TYPE_MASK)
 
3:01 PM
should i learn php
 
@anot Yes, but we're biased.
 
@cmb So ZEND_VM_HOT_NOCONST_HANDLER(123, ZEND_TYPE_CHECK, CONST|TMPVAR|CV, ANY, TYPE_MASK) Creates the type check op line correct ?
 
cmb
@ln-s the op lines are created by the compiler; the stuff in zend_vm_def.h declares the opcode handlers
 
@ln-s zend_vm_gen.php generates a few files, including the one that declares that as a constant.
zend_vm_def.h isn't actually itself included in any TUs, it's just a big meta definition
@ln-s The implementations generated from the defintions in zend_vm_def.h are the execution handlers, not the compilers.
github.com/php/php-src/blob/… <--- That's where your ZEND_TYPE_CHECK op is being generated.
 
@cmb Do you know how I can compile a .asm file on windows as part of the ext-fiber build?
 
3:16 PM
I dunno much about windows, but I think clang will recognize it as ASM if you give it a .S extension.
((clang being MSVC++'s front end aiui))
 
.S works that way on *nix, but for windows I'm seeing things about using MASM and a .asm file. The boost files I'm bundling use .asm on the windows assembly, probably for a good reason.
Oh, there is a clang version with a .S extension, interesting.
 
In the following, I’ll often show opcode sequences that PHP generates for some example code. There are currently three ways by which such opcode dumps may be obtained:

# Opcache, since PHP 7.1
php -d opcache.opt_debug_level=0x10000 test.php
 
The masm version is .asm.
 
Did this change somehow ?
I get nothing but the result output of the script
 
3:33 PM
@ln-s check that opcache is enabled (and also for cli)
 
@makadev Anyway to enable it for a particular run, and not for the entire system ?
 
never tried that, I'm swapping out ini files to enable/disable opcache^
 
-d -d
maybe
php -d opcache_enable_cli=1 -d opcache.opt_debug_level=0x100000 t.php nope
 
maybe php -c with a custom config (like switching prod/debug) with added configuration
 
use env vars for env things
 
3:50 PM
cl : Command line warning D9024 : unrecognized source file type 'C:\projects\ext-fiber\boost\asm\jump_x86_64_ms_pe_clang_gas.S', object file assumed 😞
Seems I need to build that to a .obj file first. Too bad I know nothing about building on Windows.
 
@Trowski look at the ruby build tools for inspiration from how they do it?
 
@Danack I have, though it's a bit cryptic. github.com/ruby/ruby/blob/master/win32/Makefile.sub
 
4:07 PM
oh look, a makefile: imgur.com/t/funny/tJauylk
2
 
So I've managed to figure out at some point they do make a .obj file out of it… yep… cool.
I have no idea what actually does that though, lol
 
4:32 PM
@Trowski AS, so ml/ml64 (masm) probably
 
cmb
you can just pass assembler files to cl.exe (it might delegate to AS)
 
not sure if I have a question, this may just be rubber-ducking... I'm looping through an XML document using XMLReader, trying to read the text within children nodes. (cont...)
but I'd like to move the cursor to a child node and read the value using only XMLReader... is that even possible, or will I need to resort to SimpleXML/DOMDocument?
 
cmb
@Sara no clang involved there (although PHP's Windows build chain optionally supports clang as compiler, but still uses link.exe for linking; that is broken, however, since JIT has been merged)
 
cmb
@Trowski I think the files need to be named .asm, and/or must contain intel syntax
the latter anyway
 
4:37 PM
@cmb Think I tried that before, but I'll give it a go again.
 
cmb
I think you need the masm files, e.g jump_x86_64_ms_pe_masm.asm instead of jump_x86_64_ms_pe_clang_gas.S
 
mornings
 
4:52 PM
@ircmaxell: Just seeing your port of kmyacc, can you shed some light how it is under Apache-2.0 while the source of kmyacc has the GPL-2.0 license? If it is a port, isn't it a translation and copyright is in effect?
 
cmb
@Trowski indeed, needs ml.exe/ml64.exe; that's not supported by the PHP build system out of the box; I'll have a look at this
 
5:08 PM
is it possible to position the cursor onto a child node after using getAttribute on a parent node? 3v4l.org/H2qsq
 
@Tiffany IIRC yes, child nodes come after attribute.
 
do I need to use moveToAttribute somehow?
maybe need to fiddle with END_ELEMENT
 
move back to parent node, then use read() to move to inner child node?
 
cmb
I think that should work.
 
5:15 PM
is there a way to echo my current position within the tree?
echo \XMLReader::name; probably
or var_dump
lol... starting to get somewhere now
 
you can convert in DomNode and use the xpath description from it.
otherwise you need to keep track yourself.
@Tiffany it is still at that node with the attributes, just read on until you get your match: 3v4l.org/hXUJM
 
trying to avoid using expand()
 
@Tiffany I see, here is a node-path without: github.com/hakre/XMLReaderIterator/blob/…
 
keeps coming back to my lack of understanding of interables :/ seems like the only wya I'm going to the best use of XMLReader is throwing myself into the deep end with iterables and/or generators
 
$reader->depth has the depth
that one you already have.
and if the current element is of type 1 (ELEMENT), then $reader->name also tells you the current element name.
see here with some output: 3v4l.org/j05QJ
 
5:30 PM
thanks
 
6:14 PM
anyone got any magic tricks up their sleeve for getting a locking wheel nut off when you don't have the key, or the code for the key? quickly, don't care about damaging the locker, will replace with standard
and yes I can google I mean if any has done it before and can short circuit that :-P
 
@IMSoP I did it. It's still somewhat long but its fairly better
 
6:44 PM
@Tiffany: If you do not like so much the iterators (they are kind of indirect), another alternative is to extend XMLReader and some tools your own.
 
@DaveRandom Take it to a local main dealership garage. Most only hand maybe a dozen combinations and they usually have a bunch of them sitting in the back
 
@cmb I'm really close here I think: ci.appveyor.com/project/amphp/ext-fiber/build/job/… Any idea what I'm doing wrong yet?
config.w32 for that build: github.com/amphp/ext-fiber/blob/…
 
@MarkR ideally I'd like to avoid that (probably) £500 bill but yeh that's the fallback
I was considering trying to drill it out
 
6:59 PM
@DaveRandom When I needed one because my other one had vanished and I had a tire repair due later that day, I popped over, they found one in the back, whipped off the nut and replaced it, cost me £20
 
@MarkR oh sweet I will ring them tomorrow
I don't actually want to buy one, happy to replace the lockers with standard, the wheels are cheap stock renault alloys and I don't think people really steal wheels any more
I mean I will buy one if they will sell me one for a sane price
 
Good job wheels aren't made of Copper. No-one would be driving anywhere
 
when I was at college, some gypos turned up one night with a flatbed and nicked about 4 miles of railway line
if you are wearing a hi-vi, no-one questions anything you are doing, I have walked into places and just walked out with £10K servers and no-one questioned me because I was wearing a hi-vi
(ftr I was supposed to be removing them :-P)
 
Everyone knows the only threat to servers is people wearing hoodies in the dark.
 
and @bwoebi
 
7:37 PM
And my axe!
 
Memory leak and possible double free using PDO_ODBC ・ PDO ODBC ・ #80909
 
8:05 PM
Originally I wanted to ask my question here because here are the people who probably know how to properly answer me. But I was afraid because the text was too long..
Anyway "Don't ask to ask, just ask", here's the question, dont bully me please:
-2
Q: PHP Design Pattern, separation of concerns: should the Controller make a new HTTP request to the API?

yes sureI'm having a huge doubt on how to connect the front-end of my application to its back-end. So my application has a single entry point where all requests go. The request is dispatched to a controller, which, in turn, needs to call the logic (the model), which elaborates the data, communicates with...

 
@yessure I've written some words. I'm not sure if they're the right words, but maybe they're helpful in some way...
 
@yessure What' you're describing is essentially splitting your app into 2 microservices, but not why that has any benefit. Your model server would need an HTTP frontend itself, which means controllers, which means you've just replicated a layer over the slowest communication channel you have (the network).
There are occasionally good reasons to do that, but most of the time, not.
 
yeah, that's what I was just writing up as an answer
 
@IMSoP thank you, I'm taking a read it right now
 
I'm sure there must be a better name for what I called "headless backend"
"headless CMS" is certainly a well-known term, but I couldn't think what you call it when its not a CMS as such, but something like a PHP application with React/Vue/whatever as the front-end
 
8:17 PM
@cmb Dude... I dunno... Windows is a fuckin' mystery to me.
 
@IMSoP "Over-engineered crap", most of the time.
 
well, yeah, there is that 😂
 
@DaveRandom heh
 
Also, bless you for being someone else that calls out "MVC is not a thing" server-side. I detest how Sun and later Rails bastardized the terminology and destroyed an entire generation's understanding of architecture.
 
8:42 PM
about | | to just using expand() on this...
 
@Crell yeah there is a sort of replication in my app, but I think that's necessary if I split the application. The benefits of this would be having a neat way to wire together the controllers and the models (which basically almost only interact with the database)
 
"Neat" is rarely a good reason to do something. :-)
If your models are mostly just shuffling data in/out of the database, there's extremely little value to building a 2-part application. Again, that adds a very slow extra step to every request (network), in a language that makes that more expensive than most (because of PHP's startup time), while increasing your complexity at least four fold.
 
that actually was the reason I did most of the things.
If I didn't probably now I won't have normalized and nice databases, etc.
@Crell so basically what you're saying is to just run everything in the same PHP instance, right?
then if I want to build an API I have to make one separately, ad hoc for the whole app
 
9:00 PM
If you're using PHP, 90% of applications are best handled as a single PHP process.
That includes serving both JSON and HTML. You can do both in the same app just fine. Any framework that makes that hard is a poor framework. :-)
 
@Crell github.com/php/php-src/compare/master...iluuu1994:is-expression So, I "fixed" it. By that I mean I probably made it worse.
 
@Crell I guess its time to rewrite everything in C lol
 
@yessure Why in gods name would you do that?
 
i was joking lol
@Crell okay, I got it. Yeah it actually makes sense.
 
Guys any idea the syntax of what language is this?
tooltips: {
    callbacks: {
        label: function(tooltipItem, data) {
            let label = data.labels[tooltipItem.index];
            let value = data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index];
            return ' ' + label + ' : ' + value.replace(/(.)(?=(.{3})+$)/g,"$1,");
        }
    }
}
Javascript? if yes, what's this syntax: tooltips: {}
 
9:04 PM
@Shafizadeh Object notation, assigning another object to a given property.
 
Looks like it's a fragment of JSON/Javascript.
 
ah, I will read about object notation
 
@Crell ! maybe i got a solution: I could write an interface for the controllers-models connection and make two implementations: one which just directly calls the model in the same instance and one that makes an HTTP request
what do you think
 
@yessure You could, but... why? Really, what are you trying to achieve, at a high level, that necessitates all the complexity of doubling your HTTP traffic?
@IluTov That... all looks quite logical to my highly amateur eyes. My only question would be if you want to name zend_compile_is() something else, given that we still want to add a half dozen other pattern types to it that would compile differently.
 
@Crell it's just a feature. Imagine like I have one server on the clearnet but I want to keep all the data in a secure location, maybe behind an hidden service
or just run multiple instances of the clients
no?
 
9:11 PM
@Crell I didn't change anything there, that's still from the prototype from ~1 year ago. I just changed how the type gets compared (removed the jumps/type checks/instanceof checks and replaced it with a single new opcode).
 
You can run multiple instances of a PHP application trivially, all talking to the same DB. That's one of PHP's strongest features.

For security, you're still tunneling through the front app, so there's little benefit to just forwarding requests.

The only reasons to split it up like that would be:

* There is non-trivial business logic in the model, and you want to connect to it from different *backend* languages. (Eg, you also have a Gatsby frontend.) Though it could easily be done in a single app.
90% of microservice uses are wrong.
 
@NikiC github.com/php/php-src/compare/… This is what I meant the other day. Having a single opcode for type checking would be nice. Do you see a way to handle this without introducing a new zval type? Also, the special handling in destroy_op_array is probably not too great.
 
> A firm that has the registered details of more than nine million chipped pets across the UK has been accused of losing its customers' data.

They should have chipped the data.
 
@IluTov It looks fine to me. :-)
/me needs to go run errands.
 
9:15 PM
@IluTov I think doing something like that may be okay-ish
There's only limited code interacting directly with op array literals (opcache literal compaction mainly)
 
.
I got it, well, that's pretty reasonable. But every instance at that point would have access to all the data, I am not sure if it would be fine or not.
So at this point the code snippet I posted should be fine, and all I have to do if I want an API is to just write one separately, right?
 
@yessure It does rather feel like you have a solution in need of a problem
do you actually have a security problem, or a performance problem right now, that you think this will solve?
as Crell says, being "neat" should not be the reason for doing things; you mention normalizing your database for that reason, but who knows, maybe your use case doesn't suit normalization
 
9:33 PM
@IMSoP no lol, maybe the opposite, as you said, it would lead me to performance problems
 
that's kind of where the "NoSQL" trend came from: everyone had got stuck on the idea that normalized relational databases were the only solution to storing data
 
@IMSoP about normalization, well, I also thought I didn't need it since everything was running fine, but here I got told by a lot of people that normalization was a must and so I did it
 
you need to learn a bit of healthy skepticism
 
people who had a LOT of knowledge more than me
@IMSoP yeah, probably lol
 
cmb
@Trowski interesting hack! :) On Windows, per default the objs are build in a totally different directory from the sources.
 
9:36 PM
right, but you can still understand what problem it's there to solve, even if you wouldn't come up with the solution yourself
 
cmb
The objs should be placed in C:\projects\ext-fiber\x64\Release for this build configuration.
However, the custome makefile rule (line 18) is ignored, because it is indented with spaces instead of tab.
So the default rule for asm files is used, which ignores the /FO altogether.
 
@IMSoP in this case the problem was how to implement the API, and I wrongly assumed it needed a second instance
 
cmb
I'm still buffled, why cl.exe processes inline assembly fine, but you need to pass asm files to ml.exe.
 
hance a new request
 
@yessure no, that's an X/Y problem; you haven't expressed any problem that is solved by creating the API, so you don't need to call it, because it doesn't exist
 
Anyway, thank you a lot for your help @IMSoP @Crell, I really got stuck for a while thinking about this.. hopefully I'm going back to code soon! :)
 
9:57 PM
@Tiffany: I'll be right back.
resen
 
Just a random ponderance re:8.1, what think ye all to introducing a nullable cast for (?int) that would return null if the number could not be parsed or overflowed? Or maybe an alternative to intval which either returned null or throwed.
 
@MarkR usage example?
 
@hakre Something that frequently comes up in discussions about strict types is that in some ways, weak typing provides better checks against invalid casts, as most people, myself included, just use (int)$foo which casts any bad value to 0. But 0 can be a valid value, making it difficult to determine if it was valid or not.
If we had either an (?int)$foo cast or a tryParseInt(): ?int then we'd have a way of knowing it failed, alternative we could throw, with a meaningful description for why it failed.
 
@MarkR 0 is the base to start counting from and represent a zero value. taking it weakly typed, this sounds pretty well scaling, doesn't it?
 
In weakly typed, if it cannot be converted to an integer it throws a TypeError
 
10:11 PM
but then it was not weakly typed, right? but perhaps this is about the details to that end.
let's consider a usage example of how can you proof that a string contains a clear digit integer value (no 0 prefixes) of an int in php.
in the past I did something like $string === (string) (int) $string
this does not work with stringable. for it it needs perhaps to be: ((string) $stringly) === (string) (int) (string) $stringly
so for your question would the production be: is_int(intval($mixed)) ? (int) $mixed : null ?
(intval not safe here)
 
With 8.0 we could do (?int)'bad value here' ?? throw new Exception('Error') [note: due to throw being an expression)
 
rly? didn't know it's possible to do these ?... type of casts, nice.
 
@hakre what about weakly typed but trying to migrate to strictly typed, slowly? :P
 
@Tiffany add declare(strict_types=1); on top of file ;)
 
@hakre can't, feasibly, it would break too much stuff
 
10:21 PM
@Tiffany well normally it is not a problem on many of the files as it is internal to that file only (and on the return values it get from other files which works pretty nicely)
otherwise if there are parts that are weakly typed and you know how to deal with it, that's always fine, too (IMHO).
 
Yeah, as long as the inheritance tree fits nicely, but there are cases of runaway inheritance >.<
 
@hakre It's not, it's what I'm debating trying to add
 
Legacy code problems :P
 
@MarkR I've long wanted something like this; response when I've mentioned it on list has generally seemed lukewarm
 
@Tiffany a utility like psalm is very good to find these.
 
10:23 PM
I've never put together a proper proposal, though
 
@hakre if you can run PHP in the same environment as your IDE...
(I can't :|, at least on my work machine. My home desktop is another story)
 
psalm hightlight ambiguous places, this should be regardless of ide.
I normally run it on the command-line, not within the IDE.
 
ah, there was a nullable cast RFC a while back: wiki.php.net/rfc/nullable-casting
 
so do null-able casts work now or not (in 8.0)?
 
@hakre ah. I know phpstan as a phar is available on the dev server, I've used it once before, but I really wish I could use it within phpstorm.
 
10:25 PM
otherwise if it's undefined, it might be null and perhaps the @-operator might already do it.
@Tiffany phpstorm has quite some good static analysis as well. also EA inspections.
 
@hakre yeah, tis what I use majority of the time
 
EA inspections is my tool of choice. I wish I could just psalm directly in the IDE but the PHPStorm integration is just utterly rubbish
 
@Tiffany deep-assoc completion is nice, too.
@MarkR the one with the language protocol?
haven't tried it since some months, was not that entirely bad last time.
but I normally do such runs incrementally over a projects code-base.
 
@hakre It can flag them, but for me the important part is autocomplete and such. Without that it's next to useless IMHO
 
@bwoebi <3
if anyone here ever needs a character witness for being sound and/or good people, hit me up :-P
 
10:36 PM
I have my new Desktop
 
@MarkR I do not think that autocomplete is part of the language protocol.
@Dharman nice!
@Tiffany: Your comment about iterators earlier today have me made think a bit and I came to the conclusion that the XMLReaderIterator examples might be okay-ish but they are likely over-engineered.
 
@Dharman what's the vitals?
 
XMLReader itself already provides basic iterator capabilities and that is XMLReader::read() returning true or false.
 
@hakre I was wondering, what is the point of the XMLReader? I've been talking to Tiffany about it but wasn't quite sure why it would need to exist short of parsing a multi-GB document. Does it use a file cursor inside and do stream processing?
 
It's alive! HAHAHAHAH
Ryzen 5900X, 64gb ram
the only problem is that I had to keep my old GPU
 
10:40 PM
@hakre without having looked at it, sound probably true because arbitrary XML is too complicated to be sensibly iterated
 
@MarkR it works on XML that might be overly large but also until the XML ain't valid anymore (incomplete), so you can start parsing (no need to parse the XML that does the reader) and it's not about XML-Documents but just the stream of characters.
 
XMLReaderIterator probably belongs in the same bin as as SimpleXML, unless it is an incrememental reader over a strem
 
@yessure "Do an API" is a meaningless marketing phrase from analysts that have never written a line of code in their lives. If you want to handle some requests such that they return JSON instead of HTML, you can do that all in the same application. If you can't, the framework you're using is shitty.
 
which I've pretty certain it isn't, and it if it is then it doesn't have an async API or I would definitely know about it
 
There's only about 15 different ways you can handle that, depending on the details of what you're actually doing, all of which have pros and cons, and none of which necessarily require a separate application. Some are actually harder with a separate application.
 
10:43 PM
@DaveRandom SimpleXML is a nice interface, but apart from that topic, XMLReaderIterator is just decorating over XMLReader (and an examplary use of it).
 
XML is not simple :-P
for any task that SimpleXML is a nice interface, XML is the wrong data format
 
@DaveRandom Yeah, but the simple parts you find in SimpleXML. Xpath at hand, attributes, nodes just what you normally care about.
 
@Crell LOL got it, yeah, I can easily make that. Essentially it would just be like another controller.
 
I have never once ever used it without having to eventually re-engineer unusing it
 
Honestly, thanks to SimpleXML you have a tree-datatype in PHP with a dynamic interface that you can't have with things like Array in PHP.
 
10:45 PM
Exactly. And you can map different requests to those controllers by different URLs, or a query parameter, or the Accept header, or various other mechanisms, all of which are problematic in their own special ways. :-)
 
I'll be honest that sounds horrifying on the face of it :-P
 
Thanks to the memory model, you actually don't need the XML part, but you can use it for serialization.
 
I'm not using any framework, so if it will be shitty it will be my only fault :):
 
:-)
 
I will reserve judgement though, I know what you are saying but stitching in libxml (which btw is not subject to memory_limit) sounds insane
 
10:46 PM
@Crell good, great! I really needed some directions since, well, I've never developed such a thing
 
One common approach is something like /product/123 (HTML) and /api/product/123. Any framework can do that.
 
thanks
@Crell that was exactly what I had in mind
 
If this is your first time developing such a thing, the best advice is KISS. Do the simplest thing that gets the job done while still being clean, easy to read code. Then refactor it to add functionality as needed, but only as needed.
 
@hakre I have no fundamental problem with the general ethos of what you are talking about btw, but simplexml is a horrible tool for the job
it's a double-clawed hammer even within PHP
 
over-engineering may be a hell of a pitfall
 
10:48 PM
@DaveRandom depends as usual. luckily it offers interface to DOMDocument (shared) plus you can do type-castings.
 
yeh but the fact that it doesn't use zend alloc...
 
@DaveRandom interals ... ;)
 
I remain firmly unsold on the idea :-P though deffo up for further discussion
 
btw. this might be an issue, but I've never run into memory leaks with it. perhaps because of PHPs shared nothing nature so this may vary.
 
(not now because it's Friday night and I am a bit pissed)
 
10:51 PM
@Dharman \o/
 
@Dharman They're bringing out DDR5 later this year :P
 
@Dharman doesn't the Ryzen 5900X comes with a GPU in itself?
 
No
 
so you got a new one, too :)
 
5900 series isn't APU
 
10:54 PM
@hakre the issue is more user input than shared nothing, but more than that it's just too heavyweight for what I am picturing from your description of the use case... I really would like to have more convo about this though, because a) I might be wrong and b) I have ideas that might be better for you if I am not
another time (soon) tho :-)
 
@hakre I ended up deciding to go with expand() because of the amount of work involved trying to my code to work solely with XMLReader, my skill level just isn't there yet. :( Maybe, some day, in the future when I feel more comfortable with iterables.
 
@Tiffany Yes, with expand it's often fine, you can then work on the sub-tree(s) and XMLReader can nicely forward OOTB on the same depth.
 
cmb
@hakre can't you have that with implements ArrayInterface plus __get, __set, __call, etc., as well?
 
yeah... was trying to stick with just XMLReader though but :/ hopefully, some day, I will reach the skill level where I can
 
@cmb sure, but not for xpath('...') which goes how many levels deep, fast and __get / __set magic often comes to a quick end with recursion.
or at least if not end, limited.
 
00:00 - 23:0023:00 - 00:00

« first day (3814 days earlier)      last day (1131 days later) »