« first day (3563 days earlier)      last day (1378 days later) » 

ThW
4:53 AM
@Ghostff yes //*[(self::input or self::textarea) and (@id='criteria' or @name='criteria' or text() = 'criteria')]
 
Hi there! Came up with a library - github.com/zakirullin/typed-accessor
I find it handy when working with arrays and so on, what do you think?
 
5:28 AM
Can anybody help for this question
0
Q: How do I use Laravel Query Global Scopes

Abhi BurkI am implementing Laravel Global Scope as documented here but this seems to be not working for me. Below is my line of code in User.php model <?php namespace App; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; class User extends Model { /** * The "bo...

 
6:27 AM
@ThW thanks will give that a shot.
 
 
4 hours later…
10:05 AM
hi Guys
i installed Ftp server on windows server 2012
when i want connect to ftp server via Php
connection does not work:
$connect_it = ftp_connect( $ftp_host );

/* Login to FTP */
$login_result = ftp_login( $connect_it, $ftp_user_name, $ftp_user_pass );
 
10:27 AM
@RezaAli Can you connect to the FTP server from a different client? On the same machine as the PHP code? What error message is returned (or otherwise define "does not work")?
 
@AllenJB i can connect to local ftp server (file zilla)
Warning: ftp_login() expects parameter 1 to be resource, bool given in C:\xampp\htdocs\1.php on line 23

Warning: ftp_put() expects parameter 1 to be resource, bool given in C:\xampp\htdocs\1.php on line 26
Doh! There was a problem
Warning: ftp_close() expects parameter 1 to be resource, bool given in C:\xampp\htdocs\1.php on line 34
$remote_file = 'test.txt';

/* FTP Account */
$ftp_host = '192.168.1.141'; /* host */
$ftp_user_name = 'sepand'; /* username */
$ftp_user_pass = '123456789'; /* password */


/* New file name and path for this file */
$local_file = 'test.txt';

/* Connect using basic FTP */
$connect_it = ftp_connect( $ftp_host );

/* Login to FTP */
$login_result = ftp_login( $connect_it, $ftp_user_name, $ftp_user_pass );

/* Download $remote_file and save to $local_file */
if ( ftp_put( $connect_it, $local_file, $remote_file, FTP_BINARY ) ) {
 
@RezaAli you should check that ftp_connect returns something other than false.
and do appropriate error handling when it is false. e.g. display an error.
 
@RezaAli: Make sure error_reporting is set to E_ALL - I would expect ftp_connect to be emitting a notice or warning with the reason for the error when it returns false
 
 
5 hours later…
3:46 PM
What up?
 
4:03 PM
The Sky
 
Well, I've finally done it: I inherited a project written in PHP.
Incidentally, I do not know PHP - I did one assignment in it in college. I used to work with ColdFusion, though, and I've used other web frameworks (including all of the ASP.NET variants).
 
4:33 PM
What version of PHP
 
 
2 hours later…
6:31 PM
7.3 I believe
 
At least is not 5. On what framework?
 
Wes
7:32 PM
\o
 
o/
 
Wes
8:08 PM
was reading some php tweets and ended up on twitter.com/SaraMG
did i miss some php drama?
 
Why did she get suspended
 
It was ages and ages ago
Nothing PHP related AFAIK
 
Wes
oh ok, suspensions on twitter are random anyway
 
There is a lot of trolls on twitter. It must take a lot to get suspended.
 
Or the wrong kind of politics
 
8:12 PM
ahhh
That always strikes the deepest nerve.
 
8:36 PM
> Unify the various numeric string modes into a single concept: Numeric characters only with both leading and trailing whitespace allowed. Any other type of string is non-numeric and will throw TypeErrors when used in a numeric context.
var_dump(123 + "123abc"); // int(246) with E_WARNING "A non-numeric value encountered"
@Girgias I think the sentence above is a little misleading as "123abc" will still be converted to an integer with a warning. You clarify that in the section just underneath it but those two kind of contradict each other. Maybe I'm misunderstanding something.
 
Be careful with outdated books. I was following a book's examples. Nothing seemed to work anymore. The tool had updated to a new version and all the commands in the book no longer applied.
 
@Girgias Also wonder why the secondary vote was negated (do you want to not change the behavior). Anyway, I really like the proposal :)
 
8:59 PM
I think Salathe has a vote-against quota of about 90% :P
 
Wes
troll no votes are not fun imo
php team has the reputation of being incohesive, and that's not helping
 
9:21 PM
@IluTov The thing is that arithmetic currently accept anything as it cast stuff to int with Notice/Warning, so to mitigate the BC anything which emits a Notice gets bumped to a Warning (modulo type declaration) and everything to a Warning to a TypeError
@IluTov Because currently that specific case emits an "Illegal offset" warning which is getting promoted to TypeError, so the vote is to let it still be a warning by changing it to "String cast occured" which is not promoted to TypeError (as it's for other types)
Confusing but that's the reason it's negated
 
Looks like the main RFC will pass without issue :-) ... now how do we put in a notice about whitespace :P
 
This was such a head banger trying to reason about it that I don't want to deal with that anymore xD
 
I get it. One day we'll get to a point where half our active RFCs are not making things "saner" rather than just making / adding things that are "sane" in the first place :p
At which point I will personally hire someone to do nothing but post on r/programmerhumor and correct everything they say about PHP
 
Honestly the whitespace is really the least problematic part IMHO, ain't ideal but is rather practical
The string offset bit only came out during review and Nikita and I learned about this whackiness as we both thought it would just convert illegal offsets to 0 (which would have made everything way simpler)
 
@Derick =P
 
9:36 PM
I'm not entirely sure I follow why it's converting things at all tbh, seems like if you've got something that can take an explicit string or an explicit number, converting between them is dodgy at best
but that must have been made in PHP 3 or so
 
@MarkR String offsets can only have an integer offset, therefore PHP tries it's best to convert to an integer, it's just the warning behaviour is rather odd
 
@Girgias The same behaviour applies to arrays though doesn't it? Pass a number-like string index to an array and it will convert it to an integer
 
@MarkR HA HA HA no
 
o.O?
 
@Girgias Yeah that makes sense, but the sentence would still be incorrect, no? It makes it sound like there are only numeric strings with leading or trailing whitespace and everything else will be a type error, but e.g. with 1 + '2foo' that's not the case.
 
@IluTov '2foo' is converted to 2 currently with the E_NOTICE, so i'm keepting that behaviour with an E_WARNING to ease migration, but I want to get rid of that for PHP 9
 
@Girgias Haha I get it. That's good. But above you're saying: "Any other type of string is non-numeric and will throw TypeErrors when used in a numeric context." which isn't true then.
At least not for right now.
 
@IluTov Ah indeed, well ... can't be arsed to think how to phrase that currently
 
@Girgias My point was why even bother to try to do the conversion in the first place? it's the $arr['1'] = ... which IMO shouldn't exist
 
@MarkR Technical reason, PHP's arrays are just hashtables, '1' and 1 produce the same hash
All other scalars have a "reasonable" way of being represented as int (well except float kinda) so they get converted to int and then applied the index, which turns out that for string keys you get similar behaviour for integer strings
 
10:04 PM
ah that makes sense, ty
 

« first day (3563 days earlier)      last day (1378 days later) »