« first day (1468 days earlier)      last day (3463 days later) » 

6:00 PM
@LeviMorrison Does your IDE not do printing with syntax highlighting? I know phpstorm can do it...
 
I could install PhpStorm, I guess (we have a license)
 
6:14 PM
@Charles Hey, so it has this strange background color to it...
Barely off-white, but only behind text.
You know how to get rid of that? (In PhpStorm)
 
TIL ruby exceptions are longjmp based
to me that sounds like a big memory leak
 
@LeviMorrison No idea, I've never actually done real paper printing with it, all I know is that it is a feature.
 
6:32 PM
@LeviMorrison I think - Editor / Colors & fonts / PHP / PHP code / unclick inherit and Background
Or just:
Editor / Colors & fonts / Language Default / unclick Background
 
@Danack That worked. The other one wouldn't seem to save that I unchecked the box.
 
PHPstorm probably thinks it knows best.
 
There's my test: tell me what this outputs and talk aloud while thinking about it.
 
php > echo 1 % 2;
1
wat
 
@LeviMorrison The scary thing is some people will fail that....
 
6:41 PM
sigh Integer division, of course.
1 int-divide by 2 is zero remainder one.
 
@Charles That is a somewhat disconcerting response
 
@NikiC Just had to think about it for a mo.
 
@Danack You can't fail. We just want them to talk to us about the code.
^^
We are a little bit worried about modulus, though.
 
6 mins ago, by Danack
@LeviMorrison The scary thing is some people will fail that....
Is this for an intern program or similar?
 
We have enough small tasks that aren't getting done on a consistent basis to justify another developer.
We're happy to train them, as long as they can grok basic programming.
We want a simple, no-tomfoolery example for them to talk through.
This is my first attempt at creating such an example.
 
6:52 PM
@LeviMorrison What no fizzbuzz?
 
I'd recommend including another one that has recursion in it. Annecdataly it's one of the things that people either get straight away or just don't ever: joelonsoftware.com/articles/ThePerilsofJavaSchools.html
 
> tedivm: Korvin, I wouldn't bother. ircmaxell is taking all the comments in here and dragging them back to another channel to rally people against fig. I think this is more about the drama than the issues.


@ircmaxell Stop rallying people against FIG! :P (FUUUuuuu Markdown)
 
Recursion is a definite +
I like to ask them to show me how they can reverse a linked list using both iteration and recursion, for example :)
 
Step 1) Google "How to reverse a linked list using recursion"
 
That's not too far off from what most people would actually do on the job.
 
6:56 PM
2) Give up searching, and ask on SO.
 
3) Ask again, because question closed
 
Step 2 is a myth
 
@Sherif tbh that's not a good question - either they know it (in which case the question becomes just a selector for people who have encountered that question before) or they don't know it, but that tells you nothing about the potential for solving problems.
 
@Sherif Depending on what we're talking about, I don't know that's necessarily bad. Are you saying that you never have to look up relatively trivial stuff because it just doesn't sit in your head? I have to look up the format characters for date often, the information just doesn't stay in my brain.
 
@Danack Not at all. If you know it great. The point is to see how you think about solving problems. If you don't even better. It's an excellent opportunity to show me how you think your way out of a problem.
 
6:58 PM
2 mins ago, by Danack
Step 1) Google "How to reverse a linked list using recursion"
 
@Chris looking up information is one thing. Not knowing how to think is a problem Google can't solve for you.
It depends on what the candidate is looking for (puts on their resume) too. For example, someone that has "performance" buzzing all over their resume is likely going to get some algorithmic complexity questions from me like... how do we solve the maximum subarray problem :)
The point is not that you know everything, but that you know how to think.
Someone that screams "security", on the other hand isn't likely to get those questions.
 
@Sherif If you have "performance" on your resume, the correct answer to your question is "Why would I be using a linked list?!", right?
 
@NikiC for the linked list question, sure, but then I wouldn't be asking you that, now would? ;)
I might, however, ask you something like which sorting algorithm is going to be fastest if I'm trying to sort a linked list.
Maximum subarray and sorting algos are probably good screening questions though.
 
Asking questions around algorithms where the candidate has either encountered the problem before and can remember slowly how to solve it, or they haven't encountered it before, and might not figure out the 'trick' in an interview scenario are just there to make the interview feel smarter, not to find the best candidates.
 
7:04 PM
That would make a bad interviewer, not a bad candidate.
 
There is a strong rationale behind asking algorithmic riddles in interviews.
Not when interviewing for a php job most of the time though.
 
@BenjaminGruenbaum To find people who failed lots of interviews before and therefore spent lots of time practicing their answers to algorithmic questions?
 
There are screening questions and there are interviews. You usually want to at least filter out the noise first.
 
@Danack you can come up with a twist on existing questions and verify the interviewee has some algorithmic or otherwise mathematical background. You can ask a few questions that test they know what dynamic programming is, greedy algorithms, list processing etc.
 
@ircmaxell How is RECKI_MAKE_STRING_CONSTANT(str, len) defined?
#define RECKI_MAKE_STRING_CONSTANT(str, len) ((zend_string *) "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" #len #str)
 
7:08 PM
It's very obvious the difference between people that memorize an answer to a question and people that know what they're doing.
 
@BenjaminGruenbaum Yes, but asking questions about how you use individual algorithms or where they are not appropriate to use, is far more productive at finding good candidates, rather than asking a question where there is a right or wrong answer where the person either knows it or they don't.
 
@ircmaxell That's how I'd define it, assuming that it won't be tried to change.
 
@bwoebi it's not anynmore
 
@Danack there isn't a right of wrong, there are more and less effective solutions.
 
16 mins ago, by Sherif
I like to ask them to show me how they can reverse a linked list using both iteration and recursion, for example :)
 
7:11 PM
How does that suggest there is a right or wrong answer.
The only wrong answer there is "I don't know".
Which, at that point, why are you even applying for a programming job?
 
Really? How many different ways are there to reverse a linked list using recursion?
'The only wrong answer there is "I don't know".' - That is why you fail.
 
Not different ways, but different implementations.
 
@Danack That's a bad question, I agree.
Especially since linked lists are overused anyway.
 
@salathe I saw that
 
Anyway, sounds like this headed into destructive conversation.
 
7:13 PM
@Sherif Please tell me you don't actually interview people if you think someone saying they don't know is a bad answer?
 
@Danack I don't know recursion is a good answer in your opinion?
I'm going to stop reading now.
 
Someone saying they don't know is a bad answer sometimes
 
@bwoebi The problem is getting len into the string.
 
@NikiC uh… yea… you cannot stringify it… sorry.
 
7:17 PM
@Sherif Yes - if they don't know the answer you don't want people bullshitting you....that is a way of getting a load of bullshitters into your company. Of course it's great if they go on to say, "I don't know, do you want me to solve the problem? Normally when I encounter something I don't know I go and learn about it through google, rather than sitting there trying to solve every problem from first principles myself. Or we could talk about something I'm more familiar with.".
 
anyone got a latex template for corporate docs?
I know it's very vague... but I'd just like something where I can put on the logo and company's address and be done with it
for stuff like audits...
 
static PHP_MINIT_FUNCTION(foo) {
	FOO_G(string_constants)[0] = recki_string_init("test", 4, 1);
}

static PHP_MSHUTDOWN_FUNCTION(foo) {
	recki_string_release(FOO_G(string_constants)[0]);
}
 
@ircmaxell Someone pointed out at some point that his proposal is perfectly in line with a caching implementation that he's written; as such, it could be expected that his implementation would become the "de facto" because because. I can't shake the idea that his personal agenda is driving this boat.
 
I've never said that, and I won't say that
 
7:25 PM
@ircmaxell how's that performance wise?
 
@ircmaxell Didn't say you did, someone did though.
 
@bwoebi I dunno...
 
@DanLugg That was me.
 
@Danack I was thinking it was, but didn't wanna point.
It certainly raises a valid concern, albeit, not a particularly surprising one.
 
And I also predicted that any criticism of the PSR-6 standard would be taken personally by him, as it would be taken as a criticism of his own library.
 
7:29 PM
Spending "3 years" on something is certainly going to yield an irreversible level of emotional attachment.
Though, it probably shouldn't have taken that long.
 
@Sherif We're fine with training them on that kind of stuff, if even necessary.
And definitely no FizzBuzz.
@Danack Correct.
@Danack The number of times we use recursion in our code base is exactly 0.
 
You don't calculate fibonacci numbers regularly?
 
Our code is intentionally very, very simple.
Our average lifetime for a developer is 1.5 years, so keeping it easy to understand for brand new developers is a big deal.
Which also means no framework, in case you guys are wondering.
 
"Our average lifetime for a developer is 1.5 years" - that's disconcerting.....
Do they all get offered better deals by Facebook etc or is it just a terrible place to work?
 
@Danack We use a pre-calc readonly collection; if you need a bigger value, you're probably doing it wrong ;-)
 
7:43 PM
@Danack the better the workplace the shorter people work there ;)
 
@NikiC Only eventually.....once all the good programmers who are capable of getting a better job elsewhere are left, and the company is only left with the terrible programmers who aren't able to get a better job.
 
@Danack It's because we hire students exclusively for part-time positions.
 
@Danack iirc programmers only work an average of one year at google
 
And they also ask lots of algorithm questions in the interview - I sense a cause and effect!
 
7:46 PM
And 1.5 is probably a tad bit high.
 
user895378
Less code moar Guinness.
 
@rdlowrey I'm still seeing the queued requests not being processed issue with Artax, and I haven't attempted to find a simple repo case - it's probably easier for me to send you a complete working example. Except for the fact that I choose to not commit some code yesterday, but instead deleted it and then overwrote it with a composer update.
 
user895378
@Danack I know the feeling. Can you describe the problem in a bit more detail for me? I've forgotten what exactly your issue was.
 
@rdlowrey * yells * NOOOOOOOO!!!! (hehe)
 
user895378
@bwoebi I'm actually doing code and Guinness right now. What could go wrong?
 
user895378
7:51 PM
Nothing. Nothing could go wrong.
 
@rdlowrey nothing as long as you don't exceed Ballmer peak :-P
 
@rdlowrey where do you have Guinness from? You got a tap at home?
 
@rdlowrey the program is doing the following asynchrously with callbacks i) Download tag information from github for git repos ii) Download the zip files of the tagged versions of the repos. At some point the reactor stops processing the queued requests. As I said probably best just to give you a working copy of the application and an appropriate oauth key rather than attempting to reproduce.
 
user895378
@BenjaminGruenbaum Nope, just picked up a six-pack when I went to buy some new glasses this afternoon.
 
user895378
@Danack mmmkay
 
7:55 PM
bottled Guinness is so much worse than tap :(
 
user895378
Yeah, but I have low-brow taste so it doesn't matter much to me.
 
user895378
I particularly enjoyed visiting the Guinness factory in Dublin, though. Some of their historical advertising was hilarious :)
 
Do they still have the racist stuff up?
 
I've turned into something of a beer snob over the past few years. I honestly cannot drink Budweiser or Miller anymore, the taste gags me.
 
Or am I thinking of some other brand.
 
7:59 PM
@rdlowrey I was there last year in summer…
 
user895378
@Danack They had some off-color things (no pun intended) in a "historical" section IIRC.
 
@Chris I have the same problem. My father-in-law drinks Coors Light and I've had to stop having beer when I go over to his place.
 
user895378
Coors Light ... sounds like college.
 
Coors Light, sounds like what you drink to sober up.
 
I went looking through our codebase with something simple to show to an applicant... nope, nothing.
Probably should refactor a bit... ^^
 
user895378
8:14 PM
@Danack FYI it would be wayyyy easier if you required 5.5 and used generators. Callbacks kinda suck.
 
user895378
@Danack If you don't mind requiring 5.5 I can update your code to use generators where appropriate as an example (won't bother if you care about 5.4, though).
 
well… no need to support 5.4 anyway… it's sec fixes only
 
@cspray I've made a rule for myself, I only drink beer made in Michigan. We have so many awesome breweries, I can't contemplate choking down even a Sam Adams.
 
user895378
@bwoebi except if someone wants to maximize potential users
 
user895378
but yeah, I agree.
 
user895378
8:29 PM
All my stuff is going to lean so heavily on generators going forward it will be tough for me to support (or care about) 5.4.
 
user895378
Generators make async trivial ...
 
@rdlowrey You mean like Wordpress or are you talking about real coding projects?
 
user895378
@Machavity I mean real projects. I seriously doubt if any of my code will ever be usable in a typical wordpress environment. If it is, it won't result from any special effort of mine. Compat in such cases would be a happy accident :) (sorry for super ping)
 
Non-abstract method class::method() must contain body -- does this actually provide any value? It'd be alright if I could define public function method(); as a non-abstract no-op.
 
@Chris A lot of the beer I've been drinking lately was brewed in VT. They know how to do craft breweries.
 
8:33 PM
@DanLugg then put {} instead of the semicolon. Is that one byte so bad?
 
@bwoebi I think ; over {} is more explicit that it's a no-op. Further, code analysis could ignore "unused arguments" etc.
 
@DanLugg You often enough have an unused argument because the interface specifies it, but you don't need it. For empty methods it's all the args which are unused, but that makes no difference…
 
@bwoebi *shrug*, I find I use "template-method" patterns a bit. Some methods may be required, but others are non-critical; providing an explicit no-op "implementation" for them via ; seems cleaner than {}.
You're right, it's very little gain, but it seems like an unnecessary check on behalf of the engine, to see that a body (empty of not) has been declared.
 
template-method?? what's that?
 
abstract class Base {
    public function doTheStuff() {
        $this->stuff1();
        $this->stuff2();
        $this->stuff3();
        $this->stuff4();
    }
    abstract public function stuff1();
    abstract public function stuff2();
    abstract public function stuff3();
    abstract public function stuff4();
}
 
8:38 PM
using abstract classes is the problem ;-)
 
Algorithm extension; the order of the macro is preserved, but the steps can be overridden.
@ircmaxell H'yuk h'yuk ;-)
 
^^ Yea, dunno why I didn't link to that.
In my example, if stuff1 and stuff3 were non-critical, and no-op implementations were fine, then declaring them non-abstract but closed with a ; instead of having to {} is what I'm talking about.
I'm going to stop being a syntax-lunatic now though.
 
@iamdevloper @philsturgeon “Learn PHP in 24 Hours” Hours 1 - 10 learn PHP Spend the rest of the time arguing about PSRs
 
@ircmaxell @DanLugg said he'd use the "template method pattern", not the "template method anti-pattern" which your link seems to be about… ;-)
 
8:41 PM
Shenanigans @CodingItWrong @philsturgeon @iamdevloper copy-pasting w3schools code doesn't take 10 hours
@bwoebi it's a Gang-Of-Four design pattern.
 
@ircmaxell @bwoebi You're both poopy.
 
@DanLugg in general, I prefer Strategy for that, but fair)
 
@ircmaxell Understandable, composition > inheritance (generally)
 
@ircmaxell one doesn't exclude the other
 
@ircmaxell well. I got what this is about, but from a PHP perspective it looks like an anti-pattern. I know that it's used all the time in Java, but that doesn't mean that it's good. (I personally hate it because implementation then is spread over all the inheritance layers. And generally inheritance < composition)
 
user895378
8:45 PM
@bwoebi I'm with you. Spreading things out across inheritance hierarchies like that has only led to pain in my own experiences.
 
Well, in my particular use case, most of the implementors are suitably final, so implementation spread out over layers is a non-issue.
 
user895378
@DanLugg Even then I dislike having to switch to a different editor tab to see what the class in my current tab is actually doing :)
 
@rdlowrey prepare -> execute -> dispose -- you might have to switch once ;-)
 
user895378
I'm just out on inheritance, man. You know these things :)
 
I know :-) But don't worry, we'll have you back anytime. XML is here too. It's kind of a party.
 
8:49 PM
So, I'm a bit unsure as to how I should move forward with engine exceptions. There are basically two open questions: a) Whether to keep this outside of the usual exception hierarchy and b) whether to further subclass the exceptions (and if so how)
I feel like I should resolve these two points before voting, but not sure how
 
If you do the latter, please make them very generic classes.
Of course, that may be hard to figure out ^^
 
@NikiC very true
 
how can I get open issues/prs on my repos on gh?
 
@NikiC from an API you mean?
 
used to the on the "pull request" / "issues" tabs, but now that only shows things that I created / assigned / were mentioned. not those on my repos
 
8:54 PM
issues on the top right when you view the repo...
 
no, I mean for all repos
 
user895378
@NikiC TBH I don't see a ton of benefit from subclassing the engine exceptions. It's only more information for users to know about and more code for php-src developers to maintain. I'm not sure how beneficial it is to know the type of EngineException. In any case, it might be a YAGNI situation as the engine exceptions could always be subclassed down the road without breaking BC.
 
it used to be on github.com/issues, but now that page contains only useless info
 
seems to work for me
 
Looks like you have to create a custom search, like github.com/issues?q=is%3Aopen+is%3Aissue+user%3Anikic
 
8:56 PM
ah nvm
too late to read questions properly aparently
 
@NikiC I personally feel some limited subclasses would be very useful. I don't think 100's of classes is useful, but for example a syntax error is different from a method-not-existing error, and hence I would expect them to be different excpetions...
 
though with that custom search it doesn't show issues for repos I have access to, but that aren't my own. it used to show those too previously :/
 
user895378
@ircmaxell I would be on board with a separate subclass for each of the existing recoverable fatal E_* error types ... anything more than that seems unnecessary.
 
@rdlowrey we're very much on the same page there (or not, now that I read your post)
 
@ircmaxell well, syntax errors in particular have a separate exceptions type (they were E_PARSE previously), but everything else is in one bucket right now
 
8:59 PM
@NikiC well, let me look at the errors thrown to see what else I would suggest
 
user895378
I just think that's something that's very easy to add more of down the road without breaking BC so a limited set of subclasses matching the current error types seems fine.
 
example: I'd like to see the type errors broken into their own class, so a type mismatch (passing an arguemnt of the wrong type, returning a wrong type, etc) would be good
 
user895378
@NikiC When you say, "Whether to keep this outside of the usual exception hierarchy," do you mean as the exceptions are handled by users? Like adding set_engine_exception_handler() vs. sending everything to set_exception_handler()? Or do you mean internally?
 
@rdlowrey however if we introduce subclassing it might make sense to make these direct children of Exception, rather than EngineException. E.g. a TypeException would be useful outside of just the engine
@rdlowrey I mostly mean whether catch (Exception $e) will catch it
 
user895378
@NikiC Hmm ... hadn't considered that. TypeException would be very useful.
 
9:03 PM
as far as that, I think introducing an internal Throwable interface, making Exception extend from it, and making EngineException extend it as well, would be good
 
@ircmaxell I think doing that is mutually exclusive with subclassing tho
Moving engine exceptions outside the exception hierarchy basically means "you aren't supposed to catch them", you should only catch them in top-level code (at which point the type doesn't matter anymore)
 
Isn't the intent more like "existing code isn't supposed to catch them"?
 
Yes, but we have to think about the consequences after migration too.
 
@ircmaxell any reason why doing that distinction? An user shouldn't have to care if it's an exception from some internal class or from the vm. That part should be hidden from the user…
 
@Charles If that's the intent, then it's an awful idea.
 
9:06 PM
UncatchableException extends Exception implements Uncatchable --> ParseException extends UncatchableException
 
user895378
Well, you shouldn't be trying to catch fatals on purpose ... but there is likely a lot of code out there doing } catch (\Exception $e) { that would end up doing it anyway.
 
user895378
It's a hard question :/
 
@rdlowrey catching Exception directly is anyway a bad idea.
 
It probably also depends on the exact error
 
@NikiC which is why you should subclass, because sometimes you want to "sandbox" a plugin, hence catching specific types of errors from it...
 
9:07 PM
@rdlowrey Suddenly, most PHP applications become 80% more fault-tolerant ;-)
 
user895378
@DanLugg Talk about reason to upgrade \o/ lol
 
E.g. you very likely wouldn't want to catch a TimeoutException (just as an example, not likely to be implemented), but you may reasonably want to catch a TypeException
 
@bwoebi well, that's fair
 
lol
 
@DanLugg no, please not :-(
 
9:08 PM
@NikiC You would likely want to throw a TimeoutException though, depending on what your code is doing.
 
@DanLugg ah, wut?
Timeout as in set_time_limit() here
 
Are you suggesting that TimeoutException, for that purpose, be uncatchable (or just outside the normal Exception family)?
 
I'm suggesting that some of the current fatal errors are very unlikely to need catching in normal code, while others are more likely.
 
@DanLugg you already can "catch" a timeout via a shutdown handler. So, no reason to make it uncatchable.
 
@DanLugg I think it should be uncatchable during the same execution path
 
9:12 PM
@NikiC Okay, you could rearrange the tree; Exception extends ExceptionBase and then EngineException extends ExceptionBase, TimeoutException extends EngineException -- that way all existing code catching Exception won't catch TimeoutException, but it's still catchable.
@ircmaxell I don't like the idea of catch-if conditions.
 
@DanLugg You're trying to work on the wrong end.
 
@bwoebi How so? ExceptionBase is the ...base exception. BC preserved, but you can branch off the tree so that current code doesn't suddenly become unnecessarily "fault-tolerant".
 
user895378
interface Throwable {}
 
@DanLugg You should educate users to not use catch (\Exception $e) at all except on top-level. Not try to mitigate the issue via introducing another Exceptions superclass/interface.
 
user895378
Names like ExceptionBase must die.
 
9:14 PM
@rdlowrey Okay, interface Throwable -- or interface Catchable, or interface YouDunGoofedable
@rdlowrey You'd probably want to burn my codebase.
 
user895378
interface StupidityNotifier {}
 
user895378
interface PebkacNotifier {}
 
BC doesn't come into this discussion for me
 
5 years later -- abstract class RealAbstractException3 {}
I edited that way too many times.
 
@DanLugg abstract class FinalException {}
 
9:17 PM
Hey :)
 
@NikiC C... can... can I extend it?
 
@DanLugg Nobody knows...
 
I have a question I am reading, reading and reading about OOP and I start to underatnd the point of inheritance etc etc but I see never / or I can't find a good presentation of a real life PHP example with a view and a controller or some routing where OOP is used. Did someone see already a video of this?
Would make things a lot more clear to me.
 
@NikiC abstract class RealFinalException {}
abstract class RealFinalExceptionAndWeMeanItThisTimeDamnit {}
abstract class WeGiveUpAlreadyException {}
 
abstract class GoodNightRoom11DoneForTheDay {}
 
9:24 PM
Night Dan.
 
@NikiC To resume why it should inherit from \Exception, moving it outside current Exception hierarchy is just mitigating the issue now. Also it should be hidden to the user whether it's an internal classes exception (which logically should in all cases inherit from \Exception) or a vm exception. Also, it doesn't matter what the superclass/interface for exceptions is; where people hint against \Exception today, they'll hint against the new superclass/interface in PHP 7.
 
abstract class PHPIsTheRealException {}
 
lua.org/manual/5.1/manual.html#8 <-- that's how you define a syntax
@NikiC question for you conceptually
lxr.php.net/xref/PHP_TRUNK/Zend/zend_string.h#157 <-- shouldn't there be a check in there for if the persistant flags don't match, and copy the string if so?
 
@ircmaxell not sure, but I'd guess that parameter is just there so that the compiler may inline a few things here which all depend on the persistent flag.
 
why? you can deduce it from the string s
 
9:38 PM
@ircmaxell but not at compile time.
it's eliminating a bunch of branches in that code
 
but you don't know the state of s at compile time, so you need a runtime branch for it, which is my point
because trying to persistent reallocate a non-persistent string, is bad. as is trying to non-persistent reallocate a persistent string
 
I guess it's assuming that you pass the same flag than the zend_string has.
If not, it'll blow up anyway...
 
it is
I'm saying that's not a good thing...
zend_always_inline recki_string *recki_string_realloc(recki_string *s, size_t len, int persistent) {
    recki_string *ret;

    if ((persistent ^ ((GC_TYPE_INFO(s) & IS_STR_PERSISTENT) >> 8)) == 0 && EXPECTED(GC_REFCOUNT(s)==1)) {
        ret = (recki_string*) perealloc(s, ZEND_MM_ALIGNED_SIZE(_STR_HEADER_SIZE + len + 1), persistent);
        ret->len = len;
    } else {
        ret = recki_string_alloc(len, persistent);
        memcpy(ret->val, s->val, (len > s->len ? s->len : len) + 1);
        GC_REFCOUNT(s)--;
^^ that's my new version
 
@ircmaxell hmm. I agree with you… it just introduces an extra branch...
 
Well, you could put an ASSERT around it
and error, which would be fine
 
9:47 PM
hello everyone, i am a total newbie at php and have an issue i could use some help with, I posted my question here: stackoverflow.com/questions/26534766/… and didnt get any help, anyone have any ideas? :) greatful for any help!!
 
g'night
 
55
A: Hack into a computer through MAC and IP address

David HoudeYes, this is very possible and quite easy to be honest. Before you start your attack, you need to do some information gathering. Some of the information requires a tiny bit of math, and programming. Trivial stuff. His MAC address is composed of 6 Bytes in hexadecimal format. You need to conve...

 
@Myr
@MyraFletcher: Your post is on hold because you essentially said "This is broken please fix". StackOverflow tends to prefer you show us what you did in an attempt to fix it
 
hello :)
 
have you tried verifying that the data you think is being passed is actually being passed? echo out data values and check what they are. It might point you to the solution
 
9:54 PM
well like i said, i do not code in php, i am editing a script as best I can for my client's needs, i was of the understanding this is a place where experts come to share their knowledge is it not? I have spent many hours trying different versions of this script, I have contacted the person that wrote it to no response
i just had a look at a test run and the information is not going to the database
 
can you pin point the code that is supposed to send information into the database?
 
i am looking now, this is all over my head
 
@DaveRandom The comments on that answer are hilarious
 
I reported your post to an Internet Security Administrator by the way. — ack__ Apr 19 at 11:13
 
ohnoes, not an internet security adminstrator!
Whatever will he do? Put him in internet jail?
Tarnished the mans reputation :/
 
10:20 PM
FARK YOU UBUNTU, I didn't ask for an -O2 build, why are you forcing it on me?
 
@Sherif I think they revoke your IP address for this kind of thing
@ircmaxell Why are you using Ubuntu? What did you ever do to yourself to deserve that?
 
@ircmaxell I wondered about that as well
I'd say that the correct behavior would be to drop the persistent flag and reallocate it in the same mode as the original string
 
@NikiC ok, so at least I'm on the right track
@NikiC I'm doing the opposite. Reallocate to the requested persistence level
 
but I suspect that this could have negative effects on things like smart_str, which generates a shitload of reallocs and the explicit arg allows them to be specialized at ct
@ircmaxell yeah, that's the alternative
I'd say you are right
would be nice to find a case where this would currently cause a bug. I suspect that there are no cases in core, because persistent strings will have refcount >= 2 at the point they are realloced non-persistently
 
my extension here
actually, no, that wouldn't cause a bug
ahhh, found my memory corruption bug
YAY!
 
10:29 PM
what was it?
 
if (var8 == var1) {
    var8 = recki_string_realloc(var8, var1->len + var7->len, 0);
    memcpy(var8->val + var1->len, var7->val, var7->len);
} else if (var8 != NULL) {
    var8 = recki_string_realloc(var8, var1->len + var7->len, 0);
    memcpy(var8->val, var1->val, var1->len);
    memcpy(var8->val + var1->len, var7->val, var7->len);
} else {
    var8 = recki_string_copy(var1);
    var8 = recki_string_realloc(var8, var1->len + var7->len, 0);
    memcpy(var8->val + var1->len, var7->val, var7->len);
^^ see if you can find it
 
var8 is null in the realloc last block?
 
var1 will always be non-null
 
@ircmaxell you're reallocating var8 but using length of var1?
 
@NikiC which is fine
 
10:34 PM
actually, I have no idea what that code does
 
@ircmaxell is it intentional to overwrite var1 too?
 
@bwoebi you're getting closer
@NikiC it's an optimized concat
 
you realloc var1 and var8 at the same time because it's the same pointer…
 
var8 = var1 . var7
 
@ircmaxell ahhh
 
10:34 PM
@bwoebi bingo. Which is perfectly fine, except that means that var8->val + var1->len will overflow the allocation
 
because var1 points now to unallocated memory?
 
@ircmaxell aliasing and reallocs can get you in some really fun places
 
@bwoebi that too, which is why I changed it to be this:
if (var8 == var1) {
    var8 = recki_string_realloc(var8, var1->len + var7->len, 0);
    memcpy(var8->val + var8->len - var7->len, var7->val, var7->len);
} else if (var8 != NULL) {
    var8 = recki_string_realloc(var8, var1->len + var7->len, 0);
    memcpy(var8->val, var1->val, var1->len);
    memcpy(var8->val + var1->len, var7->val, var7->len);
} else {
    var8 = recki_string_copy(var1);
    var8 = recki_string_realloc(var8, var1->len + var7->len, 0);
    memcpy(var8->val + var1->len, var7->val, var7->len);
 
e.g. when I made some simple cleanup changes to concat_function that couldn't possibly be wrong, I broke $foo .= $foo style concats, where all operands are aliased...
that probably applies to your code as well btw
also, that totally should be in a zend_always_inline concat helper function, which you only call with the right variables ;)
 
The big issue with these reallocs is just that when there are just small differences in length, the pointer often remains the same… And it then only explodes in the real thing where differences of length actually aren't so small anymore…
Sometimes I'd like if the pointer would remain the same regardless of size and be somehow virtualized away… but that's just a nice dream...
 
10:49 PM
@NikiC "right variables"?
@bwoebi why is that an issue? once I realloc, I never touch the original (thanks to the refcounting system)
 
@ircmaxell var8 = recki_string_concat(var8, var1, var7) ^^
 
why make it a function? I am generating this code...
 
debugging ;)
 
:-)
 
imho it's easier to find a bug in a concat function if the variables aren't var8, var1 and var7 ;)
 
10:51 PM
@ircmaxell Generally, not in this specific case…
 
@ircmaxell did you check whether var8==var1==var7 works already?
 
@NikiC no
because I don't need to
because if that was the case, refcount would be more than 1
 
k
 
I will test it, but now I'm getting a segfault somewhere else :-)
 
one segfault at a time :)
 
10:56 PM
yup
 

« first day (1468 days earlier)      last day (3463 days later) »