« first day (2984 days earlier)      last day (1964 days later) » 

1:17 AM
Evening
 
1:51 AM
\o
 
 
3 hours later…
4:58 AM
Hi all
Can someone please explain me why the output of below code is 0?
<?php
echo true ? 0 : true; //Output : 0
?>
I was expecting the output to be true as the value 0 is considered 'false' it should not get printed and 'true' should get printed.
 
echo $condition ? $result_if_true : $result_if_false;
So echo false ? 0 : 1; is 1.
 
@LeviMorrison : But in my code example 'true' is a pre-defined PHP constant which stands for boolean value 'true'. How can it be treated as 'false'?
 
It's not. Your code printed 0, because true is true.
 
@LeviMorrison : You mean to say like this :

Condition : If condition is true this value gets printed : If condition is false this value gets printed

Is it like that only?
 
5:18 AM
That's almost, correct, yes.
It's only printed because the echo is in front. You can do other things, like save it to a variable.
$hello = true ? 1 : 0; // $hello will be 1.
 
 
1 hour later…
6:22 AM
morns
 
7:09 AM
\o
@NikiC what's happened to ADD_INTERFACE, ADD_TRAIT and zend_do_implement_trait, can't find anything in upgrading notes about them or anything ?
/cc @bwoebi
have one of you sneekily removed traits, because I can keep a secret ?
(in master)
 
7:37 AM
hah, that's now all zend_do_linking
 
I can't find that symbol
 
8:23 AM
@JoeWatkins zend_do_link_class sorry
 
ta
what's happened to add trait opcode ? I can't see what's going on ...
 
Wes
good morning sirs
 
yomin
 
8:44 AM
Please help me As I am using a domain at Orange hosting , suddenly today its sessions are not working. 2 mont before it tested perfectly.but today after watching it is found that its session are not working not setting.I am using a codeigniter frame work
 
Wes
8:58 AM
there was an amazing youtube channel with all the commands from rhino. it's been taken down... it had like thousands of videos
it was super useful
 
Wes
9:08 AM
i still don't like this arbitrarily taking down stuff from the internet
it's not that an author of a book can erase all the book they sold by clicking a button
 
9:35 AM
@bwoebi can't you start some kind of timer?
 
10:08 AM
Please help me As I am using a domain at Orange hosting , suddenly today its sessions are not working. 2 mont before it tested perfectly.but today after watching it is found that its session are not working not setting.I am using a codeigniter frame work
 
10:22 AM
IIRC, codeigniter does not actually use $_SESSION for storing session - it uses cookies
so, it would mean that your cookies are not actually being assigned anymore
 
Problems can also arise (session changes stop getting saved) if/when the size of the session data exceeds the cookie size limits. Try clearing your cookies and see if that helps.
 
... of course, the best solution would be to stop using that piece of shit "framework"
 
10:49 AM
@FlorianMargaine what are you referring to?
 
 
2 hours later…
12:23 PM
!!dad
It seems by looking at the the wotd that @Jeeves have been down for 2 days now...
I blame @PeeHaa
 
Could be
He's not even the room
 
grinch a person or thing that spoils or dampens the pleasure of others.
 
there
 
thanks <3
!!dad
 
What did one snowman say to the other snowman? Smells like carrots.
 
12:43 PM
Hey guys! I have common programming question here.
I have a class with `getPayments`, `isFailed`, `isChargedBack` methods.
The problem is that `getPayments` runs some request to get payments list which I can work with. But both `isFailed` and `isChargedBack` methods work with this list and seems like I have to call `getPayments`in both cases.
Can I keep list of payments as instance for class object to prevent getting it twice?
How should I call that private parameter? `paymentsInstance`?
 
@dearmisterrobot What does the class represent?
 
Class represents some subscription record which can have payments from customer within itself. And payments have no class representation yet.
 
Does the class always needs payment info in order to function?
 
I think common idea should be in keeping '''isFailed''' and '''isChargedBack''' statuses somewhere in DB.
How can I mark code here?
 
Either enclose in single backticks or indent with 4 spaces
 
12:49 PM
@PeeHaa No, payment info is just one of it's functions
Single backticks enclosure doesn't seem to be working
example()
I'm wrong
 
@dearmisterrobot Well you could always just store the data in a object property, or your class may very well be doing too much to begin with
 
Good morning! Happy Monday!
 
Okay, let's imagine I have a class with some var which can be used to store some data there. This data can be used further so this var purpose is very close to singleton, or some instance. But it is not an instance actually, is stores array of... no matter, other arrays, or objects.
How can I call this var?
`paymentsInstance` is good?
 
1:17 PM
> But it is not an instance actually
Why not?
Itsounds like state to me
 
This is not state, this is like storage
So instance can be an array?
 
Wes
instance usually refers to objects but if you ignore internal differences any value is an instance of something
 
I thought maybe there is some pattern describing my needs
Moreover I'm sure there is such a pattern, but I don't know it's name
But I also think I'm wrong with the way I'm trying to implement this
 
Wes
i'm not sure what the question is
patterns that avoid you duplicates are the object pool and the repository pattern
also singleton is ok. but they become all wrong if the object pool or singleton is global
Patterns are dangerous things
want to be sure you are writing good code? avoid static
 
1:35 PM
I use private keyword for my var
 
@Wes this is difficult to understand
 
Wes
https://en.wikipedia.org/wiki/Object_pool_pattern
https://en.wikipedia.org/wiki/Singleton_pattern
 
@Tiffany yes, it kinda is
 
1:52 PM
@Wes the English is difficult to understand
 
Wes
sorry
the design patterns that avoid you duplicates are the "object pool pattern" and the "repository pattern"
does that read better? :B
 
@Wes "the patterns that avoid you duplicates"
wat
do you mean "the patterns that you avoid are duplicates"?
your subject and verb are jumbled
 
Wes
the design patterns that avoid duplicates for you are the "object pool pattern" and the "repository pattern"
 
It means that patterns prevent me to do duplicates
 
@Wes that makes more sense
 
1:54 PM
Repository pattern seems to be what I needed
 
Wes
@Tiffany i swear that sounds correct english to me
 
@Wes it isn't... and it can be interpreted in different ways because it isn't :P
 
@Wes the same for me
 
it's unclear what you're trying to get across
 
Wes
"i'm preventing you from creating duplicates"
"the design patterns that prevent you from creating duplicates are ..."
 
1:57 PM
@Tiffany are you trolling us? ;)
 
Wes
nah she isn't
 
@dearmisterrobot no, but you both are English as second language
 
Wes
she is a native english speaker and i welcome people that correct my engrish :B
 
I'm only trying to help @Wes improve his English, cause I know that's something he wants to do
 
Are you native English-speaker?
 
1:58 PM
yes
unfortunately the only language I know :<
 
Okay, sorry
 
@dearmisterrobot no worries :)
 
Wes
@Tiffany fortunately it's the only language that matters :B
 
I only correct people's English if they've indicated to me that they want to be corrected
 
I want to be corrected
Both in English and PHP
Python as well
But English is enough for now :)
 
2:00 PM
granted, I'm not an English major or anything, but I'd like to think I have an adept use of the language. e.g. I don't mistake your and you're like I see most native speakers do -_-
 
Wes
is that wrong too?
the design patterns that avoid you from creating duplicates are
maybe without "from" it sounds odd?
 
I agree
But maybe prevent is better here
 
Wes
yeah maybe i used the wrong verb
 
I can avoid using patterns.
Patterns can prevent me from doing some shit.
 
@Wes it's the use of "avoid you" that makes it confusing for me
yeah, prevent is better
 
Wes
2:05 PM
makes sense
 
Or patterns prevent me doing some shit (without from)?
 
Wes
i think i meant to use deny rather than avoid
 
now I understand what it your original statement meant, lol, I guess I'm not used to seeing "avoid" used with a non-proper noun
 
Wes
now that you pointed it out, it sounds odd to me lol
prevent sounds much nicer
 
https://chat.stackoverflow.com/transcript/message/44860293#44860293
https://chat.stackoverflow.com/transcript/message/44860312#44860312
Tiffany, can you say which one is correct?
 
2:09 PM
@dearmisterrobot no
 
I make heavy use of a thesaurus. Something something "if you have to use a thesaurus, then you're looking for the wrong word" is a quote that people like to throw around, but honestly, using a thesaurus helps me ascertain the word
 
if you use design patterns as "blueprints", then you will just create more shit
 
And can anybody tell me how soon we will be banned because of our flame? :)
 
@dearmisterrobot it depends on the context. In the context of Wes' statement, "Patterns can prevent me from doing some shit." is correct
 
Thank you!
 
2:12 PM
To make the former correct, it could be written as "I avoid patterns that cause me to create duplicates." My example could probably be made more concise.
 
@Tiffany no
 
@tereško I'm not speaking from the software engineering perspective, I'm speaking in terms of how to make the English correct
 
you missed the entire fucking point
 
you missed it
I'm correcting the English, not the act of using design patterns. That's not something I'm good at correcting :P
 
Repositories contain something called "identity maps"
the point of those is to prevent the duplicate creation of an entity
 
2:14 PM
I'm not gonna use exact repository pattern implementation
 
Wes
design patterns are essentially bullshit
 
@Wes no
 
Wes
adapter wrapper decorator proxy bridge facade
what else
 
What I actually wanted to ask is "how to call that goddamn variable"
 
Wes
essentially the same thing
object pool, singleton, repository... also essentially the same thing
 
2:17 PM
are you on drugs?
 
Wes
the basic concepts you need to know are: state, scope, dependency injection, encapsulation
ah i forgot mediator and strategy
all slight variations of "wrapping"
 
I have a method called `getPayments()` in my model. My framework (yii2) makes it possible to use `payments` as parameter instead of `getPayments()` as full function name.
So `payments` is reserved name in this case. How can I name my model parameter which contains the result of `getPayments()` to prevent getting payments twice?
Like paymentsStorage?
paymentsInstance?
 
activerecord != model
 
Model in this case is just a class who extends ActiveRecord
Does it matter?
I call this class member as paymentsArray and stop this
That's the biggest challenge for me - to call variables and class members proper way
 
843
A: How should a model be structured in MVC?

tereško Disclaimer: the following is a description of how I understand MVC-like patterns in the context of PHP-based web applications. All the external links that are used in the content are there to explain terms and concepts, and not to imply my own credibility on the subject. The first thing that...

 
2:24 PM
Thank you for this, by the way!
+100
 
@bwoebi sorry, was referring to the PDO idle timeout thingie
 
2:39 PM
Interesting article: unidays.studio30.adage.com/…
 
3:02 PM
@StatikStasis stop lurking on FB!
 
@HamZa Actually one of our former marketing VPs sent it to me. I guess he is lurking. =P
 
@StatikStasis our PR department is almost perpetually logged into Facebook
 
"Most PR departments are almost perpetually logged into Facebook." FTFY @Tiffany
 
I'm not surprised
 
I installed this to help reduce my addiction of fb: chrome.google.com/webstore/detail/news-feed-eradicator-for/…
 
3:04 PM
Pretty much required for PR and Marketing today. So many communicate and complain through social media channels versus traditional channels.
 
I killed whatever addiction I had on my own after getting fed up with crap in my news feed
I only log in to it when I need to contact someone via facebook and I don't have any other means to contact them
 
Variable values incorrect when Opcache enabled – #77310
 
@StatikStasis I am a gen-z
 
@mega6382 I'm what they sometime coin as an Xennial. I was born right in the middle of the transition from Gen X to Millennials. Which makes sense as there are traits I identify with from both groups and then traits that I hate from both groups. It's definitely a mix of the influences from those times for me.
 
@HamZa I just deleted my fb account
 
3:14 PM
@mega6382 my fb is almost a decade old :cry_face:
 
@Tiffany I still have my messenger, but no fb account attached to it, so, I can use that to contact someone who I can't contact otherwise
 
contains friends from all the way from elementary schools
 
if I end up in a ZEND_ASSERT leading to SIGABRT - how much context is required to report a bug?
 
@mega6382 in the case of FB tracking data on you, I don't think it matters
granted, I don't have the FB app on my phone for exactly the reason that they record shit without my knowledge
I have messenger on my phone with most permissions revoked, but I question if even that matters...
This is either a Wordpress problem or an SMTP problem or a certificate problem and I can't figure out which. On the server, there is a Wordpress plugin called WP Mail SMTP which is set up to send email from a contact form. I have this configured to go through our SMTP server. I have the php.ini file configured to go through our SMTP server. However, I am getting the error message:
PHP Warning:  stream_socket_enable_crypto(): SSL operation failed with code 1.
OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in C:\redacted\wp-includes\class-smtp.php on line 368
And I am not receiving mail from the contact form on the website. I haven't tested any other methods, like plain PHP code.
 
3:37 PM
@Tiffany is the SMTP server reacheable from the internet? You could try ssl-tools.net/mailservers
 
@Sjon SMTP server works for other servers
I've also had to configure the DNS for this site to use our SMTP server, since they have different domains.
 
@Tiffany but other servers might work around tls failures
 
fair point
 
@Tiffany sounds like a tls config issue
 
@Sjon reachable, and certificate shows trustworthy, protocol is secure
 
3:40 PM
@Tiffany Does the domain you're connecting to match the certificate?
 
@Trowski I'm not following. The domain with the contact form that I'm having issues with has a valid certificate.
I'm not sure if that's what you mean?
 
where does openssl on Windows get it's root-certificates from? That might be related
 
@Sjon I was thinking that too... becuase I have to do a bunch of special shit to get LDAPS to work through PHP/Windows
 
@Tiffany Well I was curious about the fact that you mentioned DNS. The domain presented on the certificate has to match the domain you're using to connect.
 
@Trowski I put in what our server admin told me to, which was an IP address. I'm not sure if that's our SMTP server or what.
 
3:44 PM
@Tiffany So you're using an IP for the connection where TLS is failing?
 
@Trowski I'm using an IP in the DNS, under an SPF1 entry.
v=spf1 ip4:111.111.111.111 -all
(note that the IP isn't actually 111.111.111.111, I've removed it)
 
@Tiffany Right, but that's just under a TXT record, right?
 
yes
 
Ok, that's fine, so that says that the server at that IP can send mail for your domain.
 
in the php.ini and the wordpress plugin, I am using the SMTP server's domain name, smtp.example.edu
 
3:46 PM
Ok, sounds correct.
 
should I throw a quick script together and try to email with that? I don't know if that would help pinpoint the problem.
 
Then what @Sjon said, the root-certificates might be out of date.
@Tiffany You could toss together something quick using amphp/socket and see if you can connect to the server with TLS that way.
 
I haven't written code with Amp yet :S
 
Oh, thought you had.
 
A lot of programming, I understand the theory of stuff, but I have very, very little practical knowledge. I can barely write clean PHP with classes.
 
3:50 PM
@Tiffany mailing in PHP is a single function call: mail
 
@Sjon yeah, that's what I was going to try
 
@Tiffany Yeah, give that a try first.
 
posted on December 17, 2018 by CommitStrip

 
accel_replace_string_by_process_permanent: Assertion `0' failed – #77312
 
mail(): Bad Message Return Path in C:\redacted\testemail.php on line 3
either I did it wrong or that's a hint
welp
 
3:57 PM
@Tiffany Not exactly, just a sec.
 
I jsut realized this server doesn't have composer on it yet
 
Eh… well you can always install that (locally if necessary).
I suppose a WP server wouldn't know what to do with composer…
 
server isn't solely for WP, I installed composer onto it and I'm putting the test stuff in a different folder
well, different hosted domain but... now that I think about it, that may affect testing...
I can just move the folder
 
instanceof_class segfault – #77313
 
@Tiffany Awesome.
 
4:09 PM
@Trowski is the second argument the port number?
for cryptoConnect
 
o/
 
nevermind, found the function definition in the library
 
@Tiffany No, sorry, the first argument should be 'tcp://smtp.domain.com:port'
 
stack trace: gist.github.com/tiffany-taylor/e25bafcbbbe8414b4cd843fb2287812d (now with an actual error message)
is there an ini setting to determine which version of SSL/TLS is used?
 
@Tiffany You can set it on the TLS Context object. e.g.: $tlsContext = $tlsContext->withMinimumVersion(\STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT);
 
4:21 PM
I still get the same error message:
Crypto negotiation failed: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:1408F10B:SSL routines:ssl3_get_record:wrong version number
 
@Tiffany Try lowering the version then.
Try STREAM_CRYPTO_METHOD_TLS_CLIENT
Or STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT, honestly I forget what some of those constants mean…
 
found this answer for a different language, but seems to be a similar situation ... it makes me wonder why it's expecting SSL (if that is what it's doing) instead of TLS
 
Nothing should be expecting SSL, TLS v1 is about the lowest anything should be running with.
s/should/would be crazy enough to
 
tried TLSv1_0, same SSL error message
going to double check that SSL3 is disabled on the server
 
Are you sure the port you're connecting to is using TLS?
 
4:26 PM
@Trowski I was told it was 25
 
25 is usually not.
 
I asked if it was 587, basing on an example I saw in the wordpress plugin, but was told it was 25
I'll try 587 for shits and giggles
587 gave the same error message, and SSL3 is disabled on the server.
thoooough the stack traces are different...
 
just received this response from server admin after asking him the question over an hour ago...
> I think it only uses TLS for authentication so you don’t need to use it since we don’t require authentication from servers
while(true) {
  $head->desk;
}
I'm at the point I'm just going to contact the vendor and ask for help. I did what they told me to, I did what our server admin told me to, and I'm having issues.
@Trowski @Sjon thanks anyway for trying to help :)
 
@Tiffany Hmm… seems SMTP doesn't use TLS until an unencrypted handshake is exchanged, which won't help my test.
I was thinking of IMAP apparently.
@Tiffany You could change cryptoConnect to just connect.
Then after the assert, add echo yield $socket->read() and see what you get.
 
4:39 PM
220 exchangeserver.example.edu Microsoft ESMTP MAIL Service ready at Mon, 17 Dec 2018 10:39:29 -0600
 
Yeah, there we go. If that's on 587, just change your original code to that port.
 
thanks (still getting the error message with the wordpress plugin, but at least I can point to this when I email the vendor)
 
Try turning off TLS in the plugin?
 
I had it set to "auto TLS" which is supposed to detect if a server is able to use TLS and change to TLS, otherwise not
but I disabled that
hmm, no error message, but also no email, unless it's delayed for some reason, or it got filtered
 
I generally use Swift Mailer, and it seems there's a plugin: wordpress.org/plugins/swift-mailer
If you happen to have a choice that is.
 
4:48 PM
I dunno. Third-party set up the site in Wordpress, they installed this plugin wordpress.org/plugins/wp-mail-smtp
 
> SMTP (Simple Mail Transfer Protocol) is an industry standard for sending emails. SMTP helps increase email deliverability by using proper authentication.
 
Looks like it overrides wp_mail, which is probably what you need.
 
... is there another way to send emails?
 
I was thinking that this would email to an email address I have access to based on what the settings for this plugin, but I'm wondering if it's instead emailing to the intended recipient (since it's a Contact Us form), and I've bombarded her with a bunch of test emails...
it's working, she received six test emails
 
5:04 PM
Heh… oops.
 
5:18 PM
Where should one store files for assertions like assertStringEqualsFile? Simply alongside the test class files? Or is there a convention of putting them in a _resources or _asserts child directory (or something like that)?
 
Wes
i've seen them in /dev
/src
/dev
/tests
 
Hmm, okay
I have /tests/VendorName/Foo/Bar/ThingTest.php
And currently I'm just storing alongside that, ThingTest_testX_expect.txt
 
Wes
ahhhhhh i misunderstood you
yeah i just have them alongside the Test.php files
 
Gotcha, at least that way they're alphasort grouped
RequireFileTemplateTest.php
RequireFileTemplateTest_test1.txt
RequireFileTemplateTest_test1_expect.txt
RequireFileTemplateTest_test2.php
RequireFileTemplateTest_test2_expect.txt
 
Wes
if they are a lot you can create a folder for each .php maybe
FooTest.php
FooTest\test1_data.txt
FooTest\test2_data.txt
..
 
5:27 PM
I'll see, I don't have many more test cases
Though I like that
 
@Wes I also like that.
 
Yeah, I switched to that, lol
 
6:17 PM
I hate how some programs treat \n as "new line" and others as "end of line" because semantically they mean different things, but it's very, very slight. For instance, an "end of line" after a closing PHP tag makes sense. If \n means end-of-line then ?>\n seems perfectly fine. But if it's new-line it opens up more questions.
 
@LeviMorrison I've never understood why there are two different types of line endings \r\n and \n. It seems like much more of a headache to not just standardize them
 
That's a different issue ^_^
Related, but different.
 
@Alesana To allow over drawing over the written characters....not just useful for teletypes, but also for progress bars in CLI apps.
 
@LeviMorrison Would \n be end of line in instances where \r is new line, though?
 
"\n" is a line ending in Unix. The "\r" in "\r\n" in Unix is garbage, basically.
Line endings are different on different platforms.
 
6:25 PM
@Danack I'm not sure if I follow how having different line endings does that, although I'm not too familiar with the subject
 
Honestly, having "\r" and "\n" separately would make this specific issue go away. I would specify "\r" without "\n" after a ?>. But I don't get to choose what a line ending is -- the programs and/or OS do.
 
@LeviMorrison That's the thing I never understood
 
6:51 PM
@Alesana Windows is case insensitive and Linux is case sensitive
though, I believe hosting a site on Linux, the URL can be made case insensitive
 
@Tiffany I think the case-sensitivity of the URL would depend more on the web server
 
Wes
@Alesana fun fact: everybody is really annoyed by mixed tabs and spaces but plenty of php files even in top tier projects have mixed line endings
bu the way, the correct line ending is obviously just "\n"
 
7:19 PM
@Wes Ha, that's funny. I guess it gets overlooked often. Doesn't Git fix that if they're using it?
 
@Alesana if they're using git, and if they select that option when installing on Windows
 
Wes
i don't think it does that by default
 
the "commit with Unix-like line endings, checkout with Windows-like line endings"
 
Ah okay, I just remember that often when I type git push it says "Changing line endings for file.php".
 
Wes
would never do that though... i don't want git to mess with my files
it should be the ide normalizing php files only
phpstorm detects the line endings used in a file and continues using that.. there is no per project setting
and i don't know what it does with mixed line ending styles
 
7:23 PM
Makes sense, I think it's moreso for teams so maybe one person wants their files to have one ending and another person wants the other, the project will be normalized on the git repo
 
8:13 PM
@tereško I'm your #1 fan
9
 
my condolences
 
8:45 PM
That deserves a star!
 
When doing a http-post-request with a redirect, the post-data is not sent again – #77314
 
@Jeeves Wouldn't that be a security flaw to sent the post-data with the redirect?
 
9:06 PM
damn
what should I play
 
Wes
@mega6382 i thought after 7 days the t-shirt would be close
but i just received the notification that it's in illinois
lol
 
@tereško Why don't you play a role model for your fan?
 
@FlorianMargaine ah, well, you could, but as said, this will have to be either a thread or an alarm signal - with all the synchronization problems this entails
 
9:54 PM
 
@Tiffany lol
 
@Tiffany lol- I have a lot of New Microsoft Excel Worksheet, New Microsoft Excel Worksheet(1), (2), etc. Same for Word docs that litter some of my folders.
 
Wes
10:30 PM
more fine tuning of the t-shirt....
i promise i am finishing it... it's more work than i have anticipated :B
 
@Wes Story of my life.
 

« first day (2984 days earlier)      last day (1964 days later) »