« first day (2146 days earlier)      last day (2788 days later) » 

12:08 AM
I realize I never ever listened to a Jon Skeet conference on youtube
proceeds
 
Ekn
12:32 AM
would you ping if you discover an interesting one, @Félix? I've been watching stuff like this ...
 
o/
 
@Ekn I'm watching this and am totally not disappointed until now
 
Ekn
\o
 
Ekn
thx, that'll be better than bots in any way
 
1:31 AM
I don't know whether to be impressed or afraid. Someone found some BASIC code I wrote back in 1999 and managed to track me down. This is either a very elaborate hoax or a happy coincidence.
 
1:42 AM
morning :)
 
@Leigh I'll discuss it with my boss :p
 
m..
2:29 AM
@sheri
@Sherif that is what happens when your a really good programmer or a really bad one
 
@m.. That's what happens when you have the same email since 1999.
 
m..
@Sherif Don't you wish you could go back to the good old days where people could change their identity and start a new life just by going to the next town over?
 
m..
@sherif a modern man then
 
@Ekn that being said, these robots are awfully nice...
 
@m.. I'm not even sure what that means. I just don't share your view that anonymity is any more difficult today than it was at some point in history. What makes you think changing your identity has anything to do with your physical geography in a world where anonymity is easier than ever?
 
m..
What? Have you not heard of the hundreds of people in the news that were discovered elsewhere through social media, and other such things. You can't as easily hide anymore it is just the state of the world.
 
@m.. Right, because we're all required to have social media accounts verified by DNA tests and independently confirmed by government analysts. It's impossible to willingly choose not to put your information on the Internet. All you're witnessing today is people becoming more accepting of what personal information they're willing to disclose online.
 
Ekn
2:58 AM
@FélixGagnon-Grenier heh indeed they are :) aaand then there is this
 
morn
 
Ekn
o/
 
\o
 
@Ekn omg. dat accent <3 !!!
also o/
 
Ekn
yeah :D
 
3:12 AM
@FélixGagnon-Grenier indian
 
I hope not to be racist when saying that is what I surmised ;-)
proceeds to buy a 3d printer
annnnd raspberry
 
Hey guys, Is there any way to fetch random rows from database except some rows?

right now I have implemented this thing in this way

while(true){
fetch_data_from_database();
if(data_is_not_in_exception_list){
break;
} else{
continue;
}

But this looks like an extremely crude way to implement what i want. Is there any better way?
 
Ekn
heh, some accents can make boring things way more interesting/fun to listen
 
ugh it's that time already. some important meeting in 12 hours
/me plays some more vampire
 
Ekn
may the luck be with you
 
3:16 AM
but all his luck are belong to me
 
that's ok, I got your bases
 
@ShubhamNishad Anytime the question is "how do I get *random* rows from my dtabase" the answer is just "STOP!". There's no valid use case in which you want random rows from a database. You may want to randomly distribute a result set. You may want to randomize a result set. But you never want a result set that consists of random data in any sane use case that isn't an XY problem.
 
@Sherif There is many cases where we want random rows. Like in my example, I am making a quiz application. And it requires to select random question from database.
There are*
 
hi
 
3:28 AM
@ShubhamNishad That would be an example of wanting to randomize a result set. That isn't the same thing as wanting random rows from your database.
There are absolutely not use cases for that other than "I don't understand how to use a relational database".
You don't just select rows at random from your database. Obviously you have some specific criteria to extract the rows you need. Choosing to randomize that resultset is not qualification of random data. It's one of random distribution.
 
I am not fetching a lots of question from the database which I can randomize.

My mobile application only ask for one question at a time. While asking for question from server I send all the previously fetched questions ids in a form of string separated by commas.

Then I fetch a new question form database and make sure that it's not one among those fetched earlier (unless there is fetched question left in the database).
unless there is no unique question left in the database*
 
@ShubhamNishad Right, that's randomizing a result set. Your result set just happens to be the entire set of rows that make up all questions that can be asked. The fact that you want to select one row at a time, at random, is exactly what makes it random distribution. The rows themselves are definitely not selected at random ;)
Stop trying to think of your database as the one that should be responsible for the "random" part. Think of it just as a place where you can store and read data. Once you do this the problem becomes easier to solve.
Obviously these rows have a prime attribute. All you really need is a way to select one of these prime attributes at random, and store each selection in some list for exclusion during the next iteration.
 
@Sherif hmmm. I was about to get all CRUSAIDE on you then you said this. right. selecting random ids from a known set makes some sense.
so... is this guy really proposing to limit the computer's memory to 2gb ram? gamefaqs.com/boards/914819-vampire-the-masquerade-bloodlines/…
 
In relational theory, a set does not care about order. So it makes no sense to start making a relational database responsible for order. What you're doing is essentially creating a set of sets. One set contains all possible questions we can ask. The other set contains all questions we've currently asked. What you're looking for lies in the intersection of "all questions" and "asked questions". You just want it to be random.
@ShubhamNishad SELECT id FROM questions WHERE id NOT IN(?, ?, ?, ...) then just pick one of those ids randomly in PHP. Is that the part you're struggling with?
 
@Sherif yeah that's what i want
NOT IN
I didn't know the syntax as I'm kinda new in this field
 
3:42 AM
Well, you're either new here or you're crazy. I've been here a while.
 
3:59 AM
morning
 
> at the time of the UNIX epoch, the time at greenwich was one o'clock
brains melt
 
@FélixGagnon-Grenier GMT has just become synonymous with UTC, but one does have daylight savings and the other doesn't.
 
4:14 AM
@Ekn so in between kicking some nosferatu arses and listening Jon speak I finally finished the video and... yeah. wow. I'm kinda reconsidering the place of php in the computer science ecosystem right now...
 
@FélixGagnon-Grenier When did PHP ever have a place in the computer science ecosystem?
 
Ekn
4:29 AM
A surprise work came up at (1.30am, yea...) so I paused it for now but well, CS is quite a huge field @Félix
 
If you're in the field of computer science you use a mainstream language like C or Java. If you're just a developer or a software engineer you might use PHP. When was the last time you ever saw a computer scientist saying "hey, let's study logic gates by using PHP"?
 
how can i match a string that have one '/' before to it eg('/home')
but ignore when it has more than one '/' before it eg ('//home' or '///home)
this donst seem to work (?<=[\\\]{1}) and (?<=\\\{1})
 
@ChrysUgwu What are you trying to do with that string, exactly? Where does it come from? What's the objective behind doing this match?
 
4:45 AM
i wanna add a html tag to word that starts with '/' in a string. but not multiple '/'
'she was /here yesterday' (OK)
'she was //here yesterday' (IGNORE)
 
OK, so then why are you matching backslashes in your regular expression when you're looking for forward slashes?
 
thats a mistake.
got used to /
 
5:00 AM
Does anyone know if PHP does optimizations like converting % 8 to & 0x7?
If not, I'll do some source digging.
 
@Trowski That's not an optimization. The compiler might optimize for it, but most likely you're microarchitecture already optimizes it.
 
@Sherif What would you call it?
But yeah, I suppose the processor might do some of that itself.
 
@Trowski premature optimization mostly. I prefer whatever is easier on the eyes or more sensible to read. The compiler will do the optimizations for me.
Compilers are pretty smart these days.
Of course you're talking about super sensitive performance work you'd be using inlined assembly anyway.
...if you're that crazy
 
I was surprised to see PHP do it though. I swapped some % 8 in a loop to & 0x7 and saw no difference.
As you said, it might not be PHP, but the microarchitecture.
 
5:09 AM
@Sherif I'm not seeing any special casing there.
 
special casing?
 
Well, other than for 0.
It converts both op values to a zend_long, then just sets the result to the mod of those to values: php-lxr.adamharvey.name/source/xref/PHP-7.0/Zend/…
 
@Sherif any idea?
 
Hi
 
@Trowski That's just the C code. You have no idea what that ends up compiling to until you actually compile it.
 
5:15 AM
is this a PHP bug?
2
Q: Convert to/from date format

PetahI'm trying to convert to and from a DateTime using z Y format (day number/year) but it seems to be off by 1 day: <?php var_dump(DateTime::createFromFormat('z Y', '239 2016')); var_dump(DateTime::createFromFormat('d/m/Y', '28/08/2016')); var_dump(DateTime::createFromFormat('d/m/Y', '28/08/2016')->...

 
Just because you write a % b in C doesn't necessarily mean you end up doing division in the CPU.
 
posted on August 31, 2016

New Cyanide and Happiness Comic

 
@Sherif Right, the compiler must optimize that based on the operands.
So much for all the stuff I learned in Comp. Sci. 101 :-P
 
It could. Depends on the compiler I suppose. Or it might not optimize it at all and the CPU might do it.
 
Now the compiler does it for me!
 
5:18 AM
CPUs are also pretty smart these days. They can sometimes figure when to short circuit division with shorter AND gates.
 
@Sherif Also very possible. CPUs do some pretty amazing optimizations now... I haven't really kept up with what's new.
 
As they should. We have bigger problems to worry about these days.
Like figuring how the fuck to deal with unicode.
 
!!xkcd unicode
 
The bane of our existence.
 
5:21 AM
Hmm… while that applies as well, I was expecting the more recent one.
!!xkcd 1726
 
The alt-text on that one is excellent.
 
Ya, who cares how many extra yacto seconds it takes you do mod over and when you spend 6 months trying to figure out how to INSERT the guy from Japan's name into your database.
What's even scarier is that we don't even get the plain old ASCII stuff right sometimes. I remember when we were demoing something infront of the board and so you had to register an account first to run through the demo. So we give it to the guy who's apparently the biggest investor and his name is hyphenated. Apparently this framework (that shall not be named) rejected hyphens in names (for God knows what arbitrary and illegitimate reason).
We make up all kinds of arbitrary stupid useless rules just so we can say "Look we can haz solved problems!"
 
@Petah Actually... it does seem like DateTime is failing to take account for 2016 being a leap year when converting from the day number.
@Sherif My favorite is arbitrary restrictions on what characters I can have in passwords.
I immediately question how they are storing the password, since what bytes I feed in as input should make no difference.
 
What moron thought that putting a maximum length constraint on a password was a good idea? Please stop making crap!! https://t.co/YMJSfrXWQv
I've seen worse.
Telling me my password cannot be more than X characters means you should step away from keyboard and stop programming immediately.
 
5:33 AM
gm all
 
You're going to store it as a fixed length hash!!! Why the fuck can't it be longer than N characters?!?! I'ts my password damn it!
 
And I don't mean things like "Your password must have a number and capital letter" type requirements. While it annoys me, I get that.
 
@Trowski No, even that's stupid.
 
I mean restricting passwords to not contain certain characters.
@Sherif Oh I agree, but at least there were some good intentions there.
@Sherif That probably means they're not storing it as a fixed length hash. :-P
 
^ that, it's insane, but it still happens
 
5:41 AM
@Trowski Well, you know what the proverb says... "The road to hell was paved with good intentions"
 
So true.
 
@Trowski And, no that's not the reason. The reason behind shit like that is the result of stupid project managers that created arbitrary requirements that developers never bothered question. Speaking from experience, 9 out of 10 project managers come up with crap like this all the time never really understanding the technical or real world consequences of what they're putting down on paper.
And yes, this is a real world production site and no the company responsible isn't a small one. They're on the forbes 500 list.
:)
So stupid people don't just exist in small companies FWIW.
 
@Sherif Haven't run into that myself, but I can definitely see that.
Well… I have run into arbitrary requirements like that.
But not a max length specifically.
 
Well, I have. Many times. I've seen more product/project managers become a direct proponent of a developer writing bad code than developers that just wrote bad code because they didn't know what they were doing.
Most of the time it's because they're just following stupid specs.
And no one bothers to question them, because well... if the guy that's 2 pay grades above me is telling me we should do this... who am I to disagree, right?
> my string stored in database as json string
I wanna cry sometimes :(
Why you people do silly things!!!
 
5:57 AM
Program received signal SIGSEGV, Segmentation fault.
zend_hash_str_find (ht=0x0, str=0x7ffff1430b1e "", len=16) at /opt/php/src/php-7.0.9/Zend/zend_hash.c:1995
1995		p = zend_hash_str_find_bucket(ht, str, len, h);
quick question: does this ht=0x0 mean I am missing a value for ht?
 
It means you have a null pointer.
 
I am reading some introduction to oop in php provided by my school. And they talk about making multiple classes with the same name and different __construct functions and that php then picks the right class based on the parameters in the initialization. I have not found anything on SO about that so far. And it sounds so weird. Is my book just wrong?
 
@Sherif yes, so I am missing a value for ht
thanks
@Schoening you cannot have multiple classes with the same name. Oh well, technically you can, but it doesnt make sense. They probably meant multiple classes implementing the same interface. What you are likely looking for is the Factory Design Pattern.
 
It's just very badly described then. It just shows two ways to do a constructor. (one with and one without parameters) and below it states that the php now picks the right one.
 
php will not "pick the right one". you have to have userland logic figuring out which class to instantiate, e.g. a Factory
 
6:07 AM
@Schoening PHP doesn't support overloading, no.
That sounds like something a C++ programmer might do.
 
Yeah that's my impression aswell. I already know oop and also in php. but we only just got to it in school
I will translate the part I am talking about since it's in danish. sec.
"Som man kan se i ovenstående eksempel har klassen Car to constructors, én med argumenter og én uden argumenter. Hvis man instantierer et objekt ude parametre, new Car(), vil den constructor uden parametre blive kaldt. Hvis man instantierer et objekt med to parametre, new Car(4, „Audi“) vil den constructor, hvor antallet af parametre passer blive kaldt."

One can see in the example above that the Car class has two constructors, one with arguments and one without arguments. When one instantiates an object without parameters , new Car(), the constructor without parameters is going to be calle
And it doesnt talk about having if statements inside one constructor. It just shows two versions of the car class.
 
Yea, that is complete rubbish. Clearly this person doesn't know a lick of PHP.
I suspect their forte is C++ or Java where that type of thing is normal practice.
 
@Schoening "the Car class has two constructors" is nonsense. A class cannot have two constructors.
 
Yeah
I just figured I make sure this is false and then go tell the teacher. Would be shit if a dozen or so students think this is a good practice
 
Not only is it not good practice it doesn't even work!
 
6:15 AM
But then again.. it's encouraged to use w3schools for troubleshooting. This whole thing is a bit of a joke
Yeah exactly.
 
Did you ever try to compile that code? It will give you a class already defined error.
 
Yeah I know. I didnt run this piece. But I have been trying some module loading stuff where I instantly got that error when I just tried including a bunch of default named modules
 
Wait... the teacher is telling you to use w3schools.com?
Is this a high school class?
s/high school/middle school
 
what would be possible is one constructor with default params, e.g. public function __construct ($wheels = 4, $type = 'Volkswagen'). Then you could do new Car() or new Car(8) or new Car(2, 'motorcycle')
 
lmao no.. we are gonna be ready to work "webintegrators" as its called here
 
6:18 AM
And I thought the American higher education system was bad.
 
Haha
 
I mean.. we're still discovering bugs in computer science text books that were written 20 years ago and are still being taught to students, but at least those bugs are about dynamic algorithms and recursion and stuff that actually matters. If you screw up teaching someone PHP you just suck at the Internet (i.e. using Google).
 
It's usually really good here. But yeah. I have always been thinking that when it comes to IT that experience means so much more than a piece of paper. But I am getting "paid" for going to school in Denmark and in the meantime I can get ready for some own projects and get experience.
But I will definitely mention this error to the teacher and classmates. So thanks for all telling me it was an actual error :)
 
6:36 AM
yasuo's excuse for a bug being expected behavior boils down to because that's what the code does.. wtf
 
what are the prerequisites for doing PG(http_globals) in RINIT? for some reason http_globals seems to be undefined.
 
Someone a suggestion for a fast upload to a table with MS-Excel data? It's only a 1-time-operation... ( List of addresses for a AJAX-search-by-zip-code) Into a mysql db.
 
@Gordon Only certain globals are initialized in certain SAPIs, but if you look at php-lxr.adamharvey.name/source/xref/PHP-7.0/main/… these are usually the ones that go through RINIT most of the time
 
6:52 AM
@Sherif I am trying to get TRACK_VARS_SERVER
 
@Gordon That ones' completely SAPI dependent.
 
@Gordon Morning, how you doing?
 
@Sherif its available in CLI afaik, so I dont understand why I am getting a null pointer
@Duikboot morning. I am doing C so I am miserable :)
 
Contributing PHP?
 
@PaulCrovella have you got an example?
moin
 
6:56 AM
@Gordon You're trying to read it from RINIT?
 
@Sherif yes, I am doing HashTable *server = Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]); in PHP_RINIT_FUNCTION. It's how I access it elsewhere, too just it doesnt work there for some reason
 
@DaveRandom !!goochle !!dad - (or however you want to chain them together) for a trensleted dad joke
 
@Gordon I've never tried reading it from inside RINIT in an extension before, but I'm guessing it might have something to do with how it's made available in CLI. Have you tried checking zend_is_auto_global_str?
You could try something like if ((Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY || zend_is_auto_global_str(ZEND_STRL("_SERVER")))) { that way you don't run into null pointer issues.
Then again, it's been a while so my C might be off here. I can't recall which macros return pointers and which return pointer pointers anymore.
Maybe you want Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]))?
No, that can't be right.
It returns the zval.
 
@PaulCrovella oic... that would need to be done on a command-by-command basis but sure, it should be possible. The problem is that each plugin tends to have it's own ChatClient instance and directly call postMessage()/postReply(), since some plugins do stuff like editing their messages or posting multiple messages. Also, a given message my in theory be handled by several plugins (although command messages aren't) so I'm not entirely sure how that would work
 
@Sherif the _P one is for PHP < 7
 
7:06 AM
I suppose we could have some kind of ChatAction abstraction where message handlers return a ChatAction[] but that would be a big refactor and I don't like it
 
Oh, they removed that in 7 huh.
Thank God!
 
Refactoring Sass code to make it more DRY - Hurray
 
:-P
I don't understand CSS, LESS or SASS and I'm completely fine with that state of affairs.
 
7:10 AM
morning
 
@DaveRandom Me too.
Well, I mean understand them... I just don't really care for them.
 
Let's both not do front end work together.
 
I love that idea.
I've always wanted to not collaborate with someone on not doing front end work.
 
achievement unlocked
 
I finally earned my stripes ma!
 
7:12 AM
Hahaha :D
 
Hello. Question. Undefined method after including the same php files in a single page. The first one works well, but the second one didn't. I'm still new in php, so are their ways to fix these?
 
What is the exact text of the error message?
 
The one I usually get is...

> Error: You suck at programming
 
:-P
 
Call to undefine method mysqli_result::getNotifications()
 
7:23 AM
Let me tell ya.... that one's a bitch to fix.
 
OK well the mysqli_result class doesn't have a method called getNotifications() (nor do any of the mysqli classes)
 
Thats my custom function.
 
Guys i am looking to convert this date 2016/222 to this format Y-m-d is that feasible ?
 
It works on the first include statement, but displays an error on the second one.
 
the format of the original date is yy/oo
 
7:24 AM
I'm a bit new in php, so I don't know the workarounds.
 
@Zange-chan what do you mean by "works on an include statement"? What exactly is the code you are including?
 
It displays notification. From the Notification drop down and on the Notification page.
 
@Joseph that makes no sense. y and o are the same thing.
 
I use include() statement to call the same file in a single page.
 
also 2016/222 is not any sane kind of date formate
 
7:25 AM
not in jquery's dictionary
 
or does that mean the 222nd day of 2016?
 
WTF is a jquery?
Is that treatable?
 
see i have this date format from the jquery 's date picker
dateFormat : 'yy/oo:',
 
@Zange-chan what's in that file?
 
@DaveRandom exactly
 
7:26 AM
ugh
 
@DaveRandom It retrieves and displays notification from the database.
 
well you certainly can interpret that but I think you'd need to piss about with date add operations
can't you just change the date picker format to a sane one @Joseph?
 
Dave basically this date 2016/230:9:25 should give this => 2016-08-17 9:25:53
 
@Zange-chan can you show the code in a gist please?
 
no i cannot, space applications deal with the day of the year
 
7:28 AM
@Joseph wait where did the 53 come from?
 
i appended the time to the string
53 is just the seconds
i dont show this, consider it not present
 
yeh but you can't get 2016-08-17 9:25:53 from 2016/230:9:25
the seconds precision is not present in the source
 
it is , in fact the other value is in a hidden field
let me show you the following
$('#implementation-date')
.datepicker(
{
altFormat : "yy-mm-dd",
altField : "#alt-date",
dateFormat : 'yy/oo:',
onSelect : function(datetext) {
var d = new Date();
$('#implementation-date').val(
datetext + d.getHours() + ":"
+ d.getMinutes());
$('#alt-date').val(
$('#alt-date').val() + " "
+ d.getHours() + ":"
+ d.getMinutes() + ":"
+ d.getSeconds());
},
});
 
oh, huh, TIL date('z')
 
This is my datepicker def alt field is where i hide the proper date format
but the thing is the field can be manually modified
 
so i have to find a way to update the alt field manually
and this is not easily done
 
The error is on the second line.
 
!!> echo DateTime::createFromFormat('Y/z:G:i:s', '2016/230:9:25:53')->format('Y-m-d H:i:s');
 
this is why i am looking to just convert it to the format i want w/o having to go through the alt field
I love you @DaveRandom Thank you
 
7:33 AM
@Zange-chan so the problem is that $notifications does not contain what you think it does.
so the problem is wherever you assign a value to $notifications
 
The notification is run on the beginning of the page. It instantiates the classes, including notifications.
It works well on the first include, but not on the second one.
 
Well, when it fails, it contains an instance of mysqli_result, so something somewhere is not right...
error messages don't lie ;-)
brb tea + smoke
 
Yup. The error is just new to me since I'm new in php.
I'm from the C# community. :v
So is there a way to fix these? Making a new one might be a hassle, and quite bad for maintenance.
 
hello how can i make it into a codeigniter code? $_POST['checkbox'][$i]
 
Morning!
 
7:41 AM
$this->input->post('checkbox') how can i make it an array? something like this $_POST['checkbox'][$i]
 
@Zange-chan the problem is before wherever you call include. If this were C# the code wouldn't compile because you'd have declared the type of the variable to be MyClass foo; or whatever, and then assigned a mysqli_result instance to it
Somewhere you have a line that does something like $notifications = $mysqli->get_result() or something like that
 
@DaveRandom Make it global or something? Since I have a class that instantiates all class, including the $notification.
 
@Zange-chan can you gist both of the files where you call include? The one where it works and the one where it doesn't
 
how to make this $this->input->post('checkbox') into like this $_POST['checkbox'][$i]
 
I don't think anyone here knows anything about codeigniter, that said, I would very much hope that if you var_dump($this->input->post('checkbox')) then you will find that it is an array
 
7:54 AM
@DaveRandom ahh i see i mean how to change this $_POST['checkbox'][$i] into CI form
but its ok i got it already
i just make it like this $this->input->post('checkbox')[$i]
 
is there a better way to make a case for actually fixing this? bugs.php.net/bug.php?id=72933
 
jeez, how can anyone work with this gdb thing
 
@Gordon Hi Gordon. how are you ?
 
@VikasSharma I am debugging a segfault. make an educated guess.
 
you helped me in making the server response fast.. one of the main point was gzip compression.. now I am getting very low response time at my front end ..
0
Q: Server Location : HTTP Response Time slow

Vikas SharmaI am from india and I am migrating a PHP application from an old server to New Server . I am using postman to see the API response.New Server Response high as compared to OLD server although NEW Server RAM is Double than the Old Server Files and Database both are on Separed Server Old Server ...

oh ok
but my web service API time is still the same..
 
8:00 AM
@DaveRandom Thanks, but I seem to find a way.
 
@MadaraUchiha can you please shoot mod message whoever just serial dv'ed me? thanks!
 
does PHP can checkall checkboxes?
 
@Gordon How dare someone take your internet points!
 
@PaulCrovella In a world first, I think I actually agree with Yasuo about something. The detect() operation is "of these candidate encodings, which does this string seem to be?" - that's just searching the string until it looks like one of the candidates and returning. If you want to validate that the entire string is actually in one of those encodings, then you use check().
The upshot of this is that detect() is basically useless, but that's because what it is attempting to do is basically impossible, not because the implementation is buggy.
 
8:02 AM
P.S. Good mnoriniaignigns
 
@salathe is that to indicate that it was you?
 
Now it's possible that it could make sense to change the signature to detect(string $str, string $candidates, int $flags), change the current true to const DETECT_STRICT = 1 and add const DETECT_VALIDATE = 2 (or something), such that it has a mode where it does a detect and then validates the entire string and only returns success if that suceeds
 
@DaveRandom a string that is completely invalid utf-8 does not seem to be utf-8, and that doesn't explain why the behavior changes when multiple encodings are given
from what I can tell non-strict exists to allow for a byte sequence that could be part of a valid string for a given encoding, e.g. ends with the first byte of a multibyte character
and that's how it behaves as long as there's more than one on the detect encoding list
 
@PaulCrovella ...and the very first byte is the first byte of a validate UTF-8 character in both of your "unexpected" examples
The problem is that "non-strict" mode is essentially useless
I understand where you are coming from, but it's something where there's not (to me) an obviously-correct behaviour
 
@Gordon No
 
8:10 AM
@DaveRandom yes, the first byte is but the remaining put the strings squarely in not utf-8 in any way territory
 
@PaulCrovella right, but it's designed as a fast, short-circuiting detection
> ...it's something where there's not (to me) an obviously-correct behaviour
^^ that's one of the options
maybe not a very good one, but it is nevertheless a valid approach to the problem
2 mins ago, by DaveRandom
The problem is that "non-strict" mode is essentially useless
 
why is it that when I set a watchpoint in gdb and then do run it takes forever and forever to continue, but when I dont have the watchpoint and call run it immediately jumps to my segfaulting position?
 
^^ this is the real crux of the issue, for me
 
@Gordon I've only down-voted anything twice this year.
 
@PaulCrovella I definitely think that if something is to be done about it, then the thing to do is to convert the bool $strict argument to int $flags and create some flags that put it into mode(s) that do what you are expecting
 
8:13 AM
@DaveRandom should using one encoding give completely different result than two? 3v4l.org/g4BOv
 
You can safely do that as long as you retain the same "strict" behaviour when $flags === 1
 
Woop woop, travel tickets arrived for NW, getting excited
 
@PaulCrovella while that's pretty ridiculous (the duplicate candidate should be eliminated to give the same result as specifying it once) again I can see why it's like that. It's designed to be as fast as possible, thus when only one candidate is given it short circuits when the string begins to look like that encoding.
 
@DaveRandom encodings typically have a very limited number of single bytes that are completely prohibited, a short-circuiting mechanism that only looks at the very first byte in a string is useful how exactly?
sure it's fast, it's a fast way to be wrong
 
I should reiterate that I'm not saying "it's fine, ignore it", but I am saying that it's not a clear-cut case of "it's broken, fix it". I agree that some better behaviour is possible, but it can't be just "fixed" because I suspect that would break a lot of existing applications that are using it (albeit badly)
10 mins ago, by DaveRandom
The problem is that "non-strict" mode is essentially useless
Unfortunately that's inescapable, though
 
8:19 AM
the entire function is essentially useless, strict or not, but that's beside the point
 
^ this is, I suspect, why no-one has bothered to attempt to improve it in the past
@PaulCrovella how about this: whenever you call that function, it emits E_WARNING: You don't know the encoding of some text you are working with? You're boned.
 
@DaveRandom you believe that there is a properly (or even partially) functioning application that relies on not-remotely-accurate encoding detection bailing out after looking at a single byte.. that fixing this bug would break.
 
@PaulCrovella I believe that people will kick off about it if you try and fix it, regardless of how true that actually is.
 
@DaveRandom I'd rather it emit E_DEPRECATED and later Fatal error: Call to undefined function
 
Deprecation on the grounds of it being a terrible idea is something I could get behind
 
ThW
8:27 AM
@NikiC Still problems with SimpleXML namespaces?
Morning
 
@DaveRandom As long as it exists though it should at least try to do something sane, something a reasonable person might expect. Right now the only advice is "don't use it, particularly don't use it in non-strict mode" - which just means it's broken. (Also if this is ever fixed there is a potential use for non-strict mode: checking a chunk of a bytestream.)
come to think of it, I have an immediate use for that exactly
 
So I just pressed ctrl-x 2 in gdb. now my life is three times as miserable :D
 
8:53 AM
@PaulCrovella yeh but check != detect, I suspect your use-case is that latter?
ping @Wes
 

« first day (2146 days earlier)      last day (2788 days later) »