« first day (2698 days earlier)      last day (2475 days later) » 

14:04
hello everybody, can someone tell me what is difference between mssql_connect alternatives (on PHP7,iis7.5, sqlserver 2008 r2, server 2008 r2)
PDO::__construct()
sqlsrv_connect()
odbc_connect()
14:15
if nothing goes right go to sleep
@JonDoe phpdelusions.net/pdo Explains what PDO is and how to use it.
It's a type of cheese. You can use it however you like, but I like it melted on toasted rye.
more helpfully though, you should use the sqlsrv driver for PDO if your PHP is running on windows, and the dblib driver for PDO if you are running on *nix
if you help people to use windows, more people will use windows ... I can just about put up with you using windows, but please, for the love of god don't encourage other people ...
you almost certainly don't need to anything that's only available through the sqlsrv_*() procedural API
@JoeWatkins ftr I don't actually run PHP on windows for anything other than a scripting language, because windows doesn't have a sane built-in scripting language.
some people do persist with running PHP behind IIS though, and I generally tell them to stahp
/me writes "more windows stuff from chris" in the record
14:23
/cc @Tiffany
@JoeWatkins I wanted to learn how to be a wind-up merchant but there was a typo.
if someone is holding a knife to your face and trying to coerce you into using windows, then you should let them stab you in the eye, rather than suffer the horror of using windows ...
windows, w*nker, the keys are like right next to each other
thanks everyone, but I do not decide windows or *ux or mac
Wes
Wes
@kelunik in the api doc generator thingy, do you think urls should match the filesystem's structure, or should match the namespaces? they match most of times, but not always
one more thing
what is difference between PDO and ODBC here
as far as I understand PDO is also using ODBC under the hood
for your information gave up trying to make sqlsrv_* to work
Any is fine😎
its *nix. also feels like you're confusing drivers available with pdo itself
yes *nix
@Wes for classes? namespaces, but you can strip the root namespace
@JonDoe PDO is a common API for many database drivers.
@DaveRandom You can't, but you can scan a list of ini options first.
Wes
Wes
i mean, if i have a file containing structural elements that doesn't match psr4 file structure, should it be shown as file, or each of its structural elements should be shown as children of their namespace, in the site navigation or whatever?
You should try to get it working with sqlsrv if at all possible, ODBC is another lowest-common-denominator abstraction that does not support some things, and is sloooooooooow
14:36
yes may be I am, could someone please eli5 why there is the difference between PDO:__connect and odbc_connect FYI i have read the manuals from php.net but still dont have an idea
@bwoebi Loop::run() blocks, so at the point where you call that either you can't await on the top-level anymore, because you're blocking in Loop::run() or you already await'ed and can no longer call Loop::run().
@JonDoe they are different APIs, they do the same thing underneath, but PDO is generally easier to use because it's simpler, and it works with more than one type of database.
@dave
so you mean to say they are same thing
like alias
of one another
@kelunik we internally obviously just do defer() that and treat it like any other fiber
no, PDO is a wrapper for a collection of drivers that presents a simple interface to the programmer for interacting with any of those drivers it wraps
14:40
@NadunKulatunge just... wow. that's a new low :P
@bwoebi That doesn't change anything. The point where you call Loop::run() still blocks.
@NadunKulatunge 01100110 01101001 01101110 01100100 00100000 01100001 00100000 01101000 01101111 01100010 01100010 01111001 00100000 01100110 01101111 01110010 00100000 01100111 01101111 01100100 00100111 01110011 00100000 01110011 01100001 01101011 01100101
^ convert this to ascii
@kelunik sure, and why is that a problem?
Loop::run() also currently blocks
@bwoebi We can't have an invisible event loop.
sure we can
14:41
And we can't allow top-level await.
@NadunKulatunge Wow you could've at least returned early so you don't waste extra time
@NadunKulatunge FYI, that got flagged
@kelunik I mean, obviously, given access to the top-level fiber
@bwoebi Access doesn't give a benefit. Nothing after Loop::run() is ever executed as it blocks.
14:43
evenings room
@kelunik We do not have to execute anything after Loop::run()?! It would be the last statement of that fiber
@JoeWatkins alright
@bwoebi And how is Loop::run() invoked then? By the user?
what would be PDO equivalent of mssql_guid_string and other mssql_* functions
please, just read the manual for pdo
14:46
@JoeWatkins in my situation, I inherited a WIMP environment and didn't know Linux well enough to know any better. I was going to make it a goal to switch to LAMP, but we're going to be switching web platforms in the near future, so it's not worth it at this point. With the new web platform, I'm going to argue for going with LAMP or LEMP, though. I have some backing with another coworker, so it might happen.
ok I am going to read one more time
(new Fiber(function() {
    Loop::run(function() {
        $awaited = Fiber::caller()->resume();
        /* similar implementation to \Amp\GreenThread\async() here */
    });
})->start();
@kelunik ^ bootstrapping code
@bwoebi That immediately invokes the fiber, thus Loop::run() and blocks at that point.
14:52
@kelunik but it continues the main fiber
and when the main fiber yields, the loop is continued
@bwoebi No, it throws an error, because the main fiber never yielded.
the fiber automatically yielded when it started the new fiber … to the new fiber
Wes
Wes
private $equence; took me several seconds to spot the problem :B
starting a fiber obviously yields control to that fiber @kelunik
resume, start, throw and yield all four yield control to another fiber
@bwoebi Yes, but it's automatically continued after the fiber that's started / thrown into / ... yields again.
14:57
the only special thing about Fiber::yield() is that yields control to the fiber which has called resume()/start()/throw() last
Fiber::caller()->resume(); will increase your call stack further and further if you call it repeatedly.
I very much prefer an integrated event loop over that.
@kelunik nope, it just switches the "last caller fiber" variable out
it's not going to deepen the stack
Anyway, this isn't my main concern. People will use this for e.g. concurrent HTTP requests with curl multi. Integrating an event loop in core then which will break those use cases isn't a good thing.
@kelunik curl has it's own event loop which you cannot really replace (unlike the amp event loop which has a global accessor)
(on the C level I mean)
I know.
15:04
also, where does that break these?
you can perfectly finely nest event loops, as long as you don't share fds or such
and have the one event loop run with another is no problem, it will just block until the other finished
You can nest event loops, but you can't mix the placeholders. Any Fiber::yield() in the whole call stack must use the same event loop.
Why is this a thing 3v4l.org/9kfSg?
@mega6382 Because e.g. while (array_shift($foobar));
@kelunik that will be an issue no matter what
that's not related here
@bwoebi Yes, hence an integrated loop, because that doesn't give a choice to use something different.
15:07
@kelunik you still will, if you happen to use curl
Yes, that doesn't allow to use fibers with curl, but so be it then.
Well, actually it's not preventable...
right, you can still just use your own event loop no matter what
But we agree that the top-level should definitely be a fiber?
yes
Ok, good. A thing we have to consider is a clean shutdown.
15:11
(or at least easily converted to a fiber at runtime)
@kelunik register_shutdown_function and set_exception_handler are still usable here
just like for any normal synchronous program
@bwoebi That's not what I'm referring to. Rather that exit; problem. I think that's fixed now, but @NikiC wanted to consider exit; as an unclean shutdown in the future I think.
@kelunik Umm, you mean consider as clean shutdown?
No, as unclean, meaning no destructors are run.
currently it's unclean shutdown
ah
Isn't there a way to both gracefully terminate and ungracefully terminate?
15:15
Currently they are run, but if they're no longer, how would such a program terminate?
something akin to kill vs kill -9
@MadaraUchiha I guess you can make the program signal itself. ^^
@MadaraUchiha the disadvantage is that you can't set a well-defined exit code with that
I'd accept there to be something like exit and quit for gracefull termination, and hard_terminate() or something with a purposely-weird name for hard termination.
SIGMADARA
I think that's a very purposely-weird name
15:18
@bwoebi Well, you shouldn't really SIGKILL from within yourself.
But here we are.
@Gordon No more than T_PAAMAYIM_NEKUDOTAYIM.
@MadaraUchiha everyone knows that means double colon. that's not weird.
@Gordon It's weird enough to have its own Wikipedia article.
Der Gültigkeitsbereichsoperator der Skriptsprache PHP wird offiziell Paamayim Nekudotayim (hebräisch פעמיים נקודתיים [paʔamajim nəkudotajim]) genannt und besteht aus zwei hintereinander gestellten Doppelpunkten (::). Das bedeutet übersetzt und transkribiert in etwa „zweimal Doppelpunkt“. Nekudotayim (Doppelpunkt) setzt sich aus Nekuda (Punkt) und der Dual-Endung -ayim (zwei) zusammen. Das Wort Paamayim besteht aus Paam (multiplizieren) und wieder der Endung -ayim. Die Verwendung des Operators erlaubt es, auf Konstanten, statische Variablen oder statische Methoden einer Klasse zuzugreifen. ��2…
Wes
Wes
lol that's amazing
@Gordon :P
15:25
I liked Madara character.
Wes
Wes
unlike the madara moderator
:B
:P
what's wrong with this @NadunKulatunge guy?
does he ever participate in any discussion or is he just posting random spam?
@Gordon his avatar is too small?
That
15:39
5 messages moved to Trash can
Wes
Wes
people have way too much free time
Yes they do.. @We
I am sorry for talking off topic
@Gordon
Don't ping...
Okay @Linus
Been a while since I shrunk a head... aaaand... poof
Wes
Wes
15:46
ah mysql upgrade, one of my least favorite things to do
@NadunKulatunge Please restrict yourself to ranting about internals and Peehaa. Thanks
3
Why is that? @Wes
Sure..
@bwoebi How much work do you think will async / await as keywords be?
And what happens if an onResolve callback throws?
Will it just call the exception handler and continue?
@Wes I googled it. Nulls do take up space when you set them to a variable, because you're storing the pointer in memory
At least, in Java :)
It was an interesting convo, you thought about it more?
Jay
Jay
Hello
Can someone help me do this: I have 120 and I want to convert it into this format 02:00:00
15:57
@kelunik native keywords? :O
Wes
Wes
3v4l.org/UKkc4 @Jimbo php returns null regardless
so your argument is invalid :B
Ah fuck, no differentiation between null and void in PHP
I am invalid in PHP, and an invalid in general
Who's the newbie flagging stuff? :)
Channel has been flag-happy this morning
Stop flagging stupid shit >:(
@PeeHaa control your room. I mean honestly.
@Jimbo there is a slight difference, for some reason. 3v4l.org/eu747
16:05
@PaulCrovella Yeah that's what @Wes was point out this morning I think
I think null and void are different, and should be treated so, because you can't pass a void around and you can a null. That by definition makes them different
Wes
Wes
they are not different, unless you have an actual type, like undefined and null in js
@Jimbo void is not something assignable to a variable, it's just null...
Hey. The system I work on handles file uploads. I've been asked to look into encrypting them while they're stored on the server. Has anyone got any ideas about that? I can't find a lot of information about file encryption. I'm just looking at the example on php.net/manual/en/function.openssl-encrypt.php
Wes
Wes
it's not that void is harmful, it's just so unnecessary
it's not that one returns null by accident
@Sean yes
ooooooo
16:14
@Wes No I mean, null is assignable to a variable. Void is not. Therefore they are different
If they are different, they should not be represented as the same
@bwoebi I think we don't even need main() to be a fiber, well I mean not having to modify it. At least not if we make PHP exit as soon as main() exists.
If you want to keep the loop running, you could just await Loop::run(), where Loop::run() returns a promise and returns the same promise if it's already running. And that promise is only resolved if there's nothing to do anymore.
16:17
@Jimbo you're saying void functions should not be valid expressions. consider how that'd impact accepting callbacks, for example
Wes
Wes
but why a function should care how its return type is used, which is null regardless @Jimbo
especially since it doesn't actually enforce that at all
it just denies me from writing return null;
what's the advantage in that
@NadunKulatunge That seems to be using mcrypt, which has since been removed from PHP.
posted on March 06, 2018 by CommitStrip

@Wes I don't see where the problem of disallowing return null; is at all. You're writing more code and complain that it errors? Why is that a problem?
Wes
Wes
is a pointless restriction
16:19
@Wes This argument doesn't argue against not representing two different things as the same, though. Maybe it's different in compiled languages as the compiler protects you pro-actively on this
@Wes Don't tell me that, tell me the problem you're facing.
@kelunik what problem did the restriction solve in the first place?
@Ekin Ah. That looks interesting. Have you used it before?
I don't think it was a restriction for the sake of a restriction though, it was "this is a fact that this returns void, so you can't return anything". Not that "this is a fact that this returns void, so you cannot return null"
If what you want were to be implemented, they would have to add the additional code to check just for a null and allow that...
@PaulCrovella Consistency with what has been declared.
16:21
@Jimbo but you do return something, you return null. void is just lying to you.
@jjok yeah I played with it. github.com/defuse/php-encryption/blob/master/docs/classes/… quite straightforward
@PaulCrovella Isn't null a type?
@PaulCrovella Which should be considered an implementation detail IMO.
@Jimbo yes
and void isn't... so they're different. You don't have a type to play with
16:22
huh?
void isn't a type you can use, I mean
@PaulCrovella Is there an explicit check for return null; or is it return <any_expr>;?
$x = null; // yep $y = void; // nope (maybe that's called a "first class type"? educate me on that)
@kelunik I think it's the latter
@PaulCrovella So there you have the reason why it has been added.
16:23
Exactly, its any_expr, so what you're asking for is an explicit check for <any_expr|null>
If you return an expression, you're probably doing a mistake if you declared the function void.
Wes
Wes
and why the hell isn't this allowed
class Foo{ function bar(): ?Foo{} }
class Baz extends Foo{ function bar(): void{} }
i thought it was
@Jimbo huh?
Because nobody implemented manual covariance checks for that, probably.
Wes
Wes
class Foo{ function bar(): ?Foo{ } }
class Baz extends Foo{ function bar(): void{
    return parent::bar(); // also can't do this if i'm 100% sure that parent::bar() will return null
} }
again, what's the point of this kind of restriction?
i can agree it does no harm, but what's the advantage? what problem did it solve?
16:30
@Wes because the php manual already used void and they needed an excuse to use it in the language instead of simply null without the restriction
@Ekin Thanks. I'll give that a go.
yw
Wes
Wes
@PaulCrovella :shrug:
@Wes It doesn't make sense what you're doing. You're doing something wrong, because you're returning something while you declared the function void.
@Wes I had an rfc to replace it with null before it was released, but life got busy and nobody picked it up to run with it.
16:37
@kelunik with async/await you do not have callbacks anymore
@Wes With that argument you could say that the (unset) cast should have never been deprecated, because you could to return (unset) $function() with that and any return value of $function.
@bwoebi They're still useful if you want to share async operations.
But I guess you could just do async (function () use ($promise) { await $promise; })();
@kelunik yep
Wes
Wes
@kelunik but if it returns null regardless, why should i care about the form
parent::bar();
return;
why exactly am i forced to write it like that?
@Wes Go write an RFC that changes it and un-deprecates the (unset) cast.
@Wes you shouldn't have to, but that ship has sailed and will never change now. may as well get used to it.
Wes
Wes
16:40
...
@kelunik dude, cmon
> A void return type cannot be changed during inheritance. You can see this as either because return types are invariant, or because they are covariant and nothing is a subclass of void.
@Wes the answer is correct though
@Wes Discussing here won't change it.
Wes
Wes
i am just complaining
but i might rfc it out on april 1st :B
just for the lolz
@Wes I know, but I won't discuss any further with you now, because I don't have the time for that.
Wes
Wes
16:43
me neither, right
it's just so strange that we bothered getting that
it's so superfluous...
and weird...
@bwoebi @bwoebi How do we handle things like OutputBuffer in amphp/byte-stream then?
Morning.
@bwoebi I guess people just have to use the internal Deferred then?
@Wes What's a good case you've come across for an aggregate having an aggregate root and 1 or more entities?
Wes
Wes
hm... anything?
16:50
Every single time I try to make an aggregate that encompasses an aggregate root and one or more other entities it ends badly.
Wes
Wes
but it's true that it's likely that 1 aggregate = 1 entity
@kelunik yeah, we then would just do away with such hacks
A Promise would be a final method-less class, not an interface
@bwoebi It's not a hack. Message is a hack.
@Wes Know of any cases to the contrary?
@kelunik both is
16:53
Not sure whether we need Deferred for that, but it would make it easier.
Wes
Wes
@Allenph not sure, probably not
that could be a good pattern to follow though, 1 aggregate = 1 entity. what are you modeling specifically?
Just that product catalog thing we talked about the other day.
I don't understand the point of aggregates then.
@bwoebi I'm not talking about it directly implementing promise, but rather the generic functionality. I think it requires a Deferred in core, async / await alone is not enough.
@kelunik we don't.
Seems that's almost never a useful abstraction.
16:54
@kelunik what do we need it for?
@bwoebi Show me an implementation of OutputBuffer without Deferred.
If should implement OutputStream and offer a getContents() method that is always async and returns the contents once the stream ended.
@Allenph you're never going to get your DDD merit badge talking like that
@PaulCrovella I'm not interested in merit badges. I'm interested in climbing out of this hell-hole I call a job.
I'm just being snarky about ddd
I see it as training wheels for SOLID.
The biggest thing I have left is tests. So far I have not found a single testable case that I can think of other than the mappers and that seems like a monolithic task.
17:02
@Allenph Your profile says that you like what you're doing.
@Allenph that's not how it works
and what do you mean by "testable case" ?
@jjok Not at work.
@tereško Sure seems like it works. DDD gave me a semi-concrete way to implement SOLID.
The more I do it the more I understand the concepts then I can start breaking the DDD rules.
@tereško I guess repositories can be tested, but factories don't seem like they need a test and the entities I've built so far don't really have any behavior they're just kind of data dumps.
how many factories do you have ?
Wes
Wes
just in case it's needed: i several times suggested him to not abuse factories :B
I tend to use 1 per codebase - for making mappers
well ... two, if in process of refactoring (for services), and I dont have an access to a magical DIC singleton (as step in refactoring) .. because some codebases are still pre-5.3
Wes
Wes
17:10
don't confuse him, that's gotta be one class with several factory methods
right? :B
Wes
Wes
i imagine him being in panic right now
I have a butt ton of factories.
Wes
Wes
you can use a factory for everything if you want @Allenph it's what i was trying to tell you, but that doesn't mean you should :P
17:12
I don't get why it goes ddd -> solid for you
^ that too
I have an abstract factory for each entity, and then a factory for each persistence mechanism for each entity.
he might be one of those people who "learn by doing", @Ekin
dry, kiss, solid are principles one better get to learn before all that
@Ekin Just what I was exposed to first. It's more defined than SOLID so it's easier for me to learn the concepts by building an implementation of a paradigm which implements SOLID.
If that makes sense.
17:13
in other news: looks like "Long Distance Calling" have released a new album
@tereško Definitely that.
@tereško do you use spotify btw?
nope
all my music is stolen FLACs
heh
> FLACS is a commercial Computational Fluid Dynamics software used extensively for explosion modeling and atmospheric dispersion
What's flacs??
17:18
it's free lossless audio codec
FLAC (; Free Lossless Audio Codec) is an audio coding format for lossless compression of digital audio, and is also the name of the free software project producing the FLAC tools, the reference software package that includes a codec implementation. Digital audio compressed by FLAC's algorithm can typically be reduced to between 50 and 60 percent of its original size and decompress to an identical copy of the original audio data. FLAC is an open format with royalty-free licensing and a reference implementation which is free software. FLAC has support for metadata tagging, album cover art, and fast...
Thanks
@Linus it's a high-quality format for audio files
let's put it this way: you need to invest some money in the gear for it to have a point
can anyone help in this script i want to get multiple arrays but it's return single array in my script
http://sandbox.onlinephpfunctions.com/code/86ddd8689d8f3aa31f32f17c77982758bd69c3e9
Hi @tereško
@bwoebi We also need Deferred for interacting with the event loop btw. ;-)
17:32
@tereško i downloaded vox demo track , now i can feel difference.
@Linus well, it's the format, that validates inverting in Sennheiser :P
also, my english seems to be failing ... I should stop working ASAP
:p
huh. it's 2018 and til excel can't open two worksheets with the same name at the same time
I still need to write 3 integration tests for authentication controller, and then I can go home
Can have anyone see my problem ?
17:38
@RaheelAslam Is your problem that you think that just thinking about code is the best way to debug stuff, rather than actually stepping through the code with a debugger?
!!debugger
@Danack arrays is showing one time it should show multiple times
@Linus You need something like this to take full advantage
I think some items there have updated versions
@JoeWatkins probably not ...
That sounds like the kind of abuse that we wouldn't want to encourage :P
well with the restriction that you can only cast user defined types (no create_object) it gets much simpler, and much faster ...
17:45
@JoeWatkins I think that's pretty much how it always goes. Most of the weirder stuff is limited for internal classes (reflection stuff etc)
@Danack seeing?
@IROEGBU I have these :D
@kelunik Not sure about context, but exit is already an unclean shutdown and generators won't run finally on unclean shutdown anymore. We might want to make it clean in the future by converting exit into an exception
@NikiC An exception won't solve it in case of fibers.
@bwoebi We still have the long-standing issue with handling of dtors that add references to the destroyed object. Maybe that? Is this an issue that appeared after the GC changes or older?
17:48
@NikiC reverting past the gc changes the issue disappeared
@bwoebi crap :P
@NikiC Currently destructors are run on exit;: 3v4l.org/FcZAB
@kelunik destructors are, but finally isn't
@Jeeves :p
@NikiC I just have no concrete idea how to debug that thing as I'm not really sure what exactly should or shouldn't have happened
17:50
@bwoebi is this a vanilla build or fiber related?
@NikiC With fibers.
But as said, issue disappears with reverting it
eh
@NikiC Yes, because of the bugfix only. 3v4l.org/Yeajc
@tereško That is pretty expensive!!!! But, it really does look good and has a ton of good reviews /me adds to list
@bwoebi hard to distinguish though between it being a bug and just not triggering due to gc running at different times
That said, I also saw some GC-related valgrind warnings on artrax-adapter (or so). Unfortunately on a test case that was previously already crashing, so also don't know if that's a new issue or not ^^
17:52
I am not getting one multiple array can you suggest best things please
@bwoebi You can try enabling ZEND_GC_DEBUG and see if anything insightful turns up
@NikiC I'll try it in a few min
@NikiC You use that with HTTPlug or which adapter?
Does an object of the base class get created when we create an object of the derived class? I think this is not the case.
@kelunik I actually have no idea what it is, it just happens to lie around
I'm not using it
18:01
nite
18:23
@IROEGBU yeah, my purchasing habits are quite odd
for example: I will usually have only single pair of jeans, but they will usually cost somewhere in vicinity of 100€
instead of 10€, like my younger brother does
 
1 hour later…
Anonymous
19:42
Is it possible to embed HTML elements inside the canvas element during a stream?
<?php
use function Componere\cast;

class Base {
	public $std;
}

class Child extends Base {
	public $two = [1,2];
}

echo "refs:\n";
$base = new Base;

$child = cast(Child::class, $base);

var_dump($base);
$child->std = new stdClass;
var_dump($base);
what do you expect default behaviour to be ?
@JoeWatkins an E_KRAKENS error?
but other than that ?
object(Base)#1 (1) {
  ["std"]=>
  &NULL
}
object(Base)#1 (1) {
  ["std"]=>
  &object(stdClass)#3 (0) {
  }
}
or
object(Base)#1 (1) {
  ["std"]=>
  NULL
}
object(Base)#1 (1) {
  ["std"]=>
  NULL
}
ahhh, do I expect references to be retained
so, I don't expect either
I would expect:
object(Base)#1 (1) {
  ["std"]=>
  &NULL
}
object(Child)#1 (1) {
  ["std"]=>
  &object(stdClass)#3 (0) {
  }
}
or maybe not
I don't know
huh ?
it's base being var_dumped both times ...
19:50
I would still keep it the same root object if possible
/me doesn't know /me is crazy today and can't think
I'm asking if changes to the object returned as a result of call to cast() should effect the instance passed to cast() ... should it cast by reference by default in other words ?
cast_by_reference sounds so wrong in my head
I think it should cast by reference, otherwise why not decorate?
unless you have two functions: cast() and cast_by_ref()
I've got both
cast_by_ref is a bit easier to read than cast_by_reference ...
I'll use that ...
I was going to use @cast for cast_by_ref, but it's too strange ... and I can't use &cast()
or cast(..., &$instance);
cast<&Type>($instance)
cast<Type>($instance)
something like that would be nice, but I can't be bothered with internals ...

« first day (2698 days earlier)      last day (2475 days later) »