« first day (1688 days earlier)      last day (3266 days later) » 
00:00 - 19:0019:00 - 00:00

user1648409
7:00 PM
@PeeHaa i currently use simpletest.org for some unittests (200+) in a testsuite, i know that phpunit is the better solution, but we didn't know that beforehand and now we have 200+ unit tests in simpletest, so we won't change that. When trying to pass the db connection from the main testsuite to the subtests i didn't know how to do that so i ended up packing it into $GLOBALS so i can use it in the subtests. I currently think that this is a) not a good solution and
 
user1648409
@PeeHaa b) the source of this "out of sync" error
 
Do you free the result?
Because the docs are pretty clear on this
 
user1648409
@PeeHaa wait, checking
 
user1648409
@PeeHaa oh god... i am not. that should be the source of this... i did everything correctly reguarding prepared statements, transactions and even the table locking but i forgot about freeing the result -.-
 
user1648409
@PeeHaa thanks!
 
7:04 PM
That's why I told you to RTFM
Code doesn't give a shit about your feelings
6 mins ago, by PeeHaa
When somebody asks you why some technical thing X doesn't work answering with "I have a feeling" is... strange
 
user1648409
@PeeHaa heyhey. I am doing transactions stuff for the first time...
 
Even more reason to read the docs ;)
Also having that global state throughout unit tests sounds like a terrible idea
Why do you need db access throughout your unit tests either way?
 
user1648409
@PeeHaa yes it is a terrible idea, but it works (at least it is useable)
 
It sounds like you are not really unit testing, but rather integration testing
 
user1648409
@PeeHaa might be. by the way: i added $result->free() on the one thing i am currently testing and it still gives me out of sync errors...^^
 
user608540
7:12 PM
Hello, I need a suggestion. I have recently purchased a unmanaged dedicated hosting with Cent OS installed. But I want to install another server like Homestead ( for laravel ) with that. Is their tutorial / guideline out there how can I install a second server in my dedicated hosting?
 
@Shiuyin Well it's going to be hard to tell you what exactly is wrong necause if the global state it can be anything
 
user1648409
@PeeHaa =/
 
@Khaled Something unclear in the official docs? laravel.com/docs/5.0/homestead
 
user1648409
@PeeHaa given that fact, that i need the db connection in the subtests - how else can i possibly pass the reference to the db connection from the main testsuite (where it is initialized) to the subtests so they can work with it?
 
Simple. You don't
The entire idea of unit testing is that you test in isolation
 
user1648409
7:16 PM
@PeeHaa ok, then lets just say, i am doing the unittests wrong, but i still need to finish it until tomorrow (which is exactly the case) - how should i try to still make it work?
 
user608540
@PeeHaa I actually need to know can I install second development environment in dedicated hosting beside existing one both working properly.
 
user608540
@PeeHaa I already read that guideline.
 
@Shiuyin Idunno. Basically you have made some wrong choices for which there is not an easy fix. Sorry
@Khaled Doesn't it tell you to setup vagrant?
 
user608540
Yes, It does.
 
user1648409
@PeeHaa its really cool, when you are a group of 5 with 4 people just knowing and doing exactly nothing and youre the one who has to do everything :D
 
7:19 PM
TooManyOpenConnectionsException or ConnectionLimitExceededException? Does anyone have a better name?
 
@Shiuyin :P
blind leading the blind
@Khaled So. What is not clear in specific?
 
user1648409
@PeeHaa im not blind, at least not compared to them. compared to you, maybe. but there is always a better one so that doesn't count.
 
the visually impaired leading the blind :P
 
user608540
@PeeHaa If I install Vagrant / Virtualbox for the purpose of installing homestead will it conflict with my existing development environment ( easy apache )
 
@kelunik Everything I can come with is basically what you have
 
user608540
7:22 PM
@PeeHaa WHM/Cpanel installed already
 
@Khaled Nope. It's a virtual machine thingy
 
user1648409
@PeeHaa i guess i have to split up the testsuite and handle all 200 subtests seperately ...
 
I could maybe drop Open or Exceeded. Or just use WowSoMuchOpenConnectionException ^^
 
:D
 
user1648409
thanks anyway
 
user1648409
7:22 PM
see you
 
np Good luck :)
Hmm what about just ConnectionLimitException @kelunik?
 
@PeeHaa Yeah, that's that I were juts doing. :)
 
I like it better than TooManyConnectionsException I think
 
I have a webpage which has a youtube iframe and gogle maps iframe. The youtube iframe is being replaced by the google maps iframe. I can't figure it out. Its really annnoying... help please and thanks
Any ideas would be great... xquisiteshisha.co.uk
dw fixed the problem
lol it was funny
 
Anonymous
function ChuckNorris($e){
   echo $e->getMessage();
}

set_exception_handler('ChuckNorris');
throw new \exception('villain');
 echo 'I should be  visible';
 
Anonymous
7:34 PM
@PeeHaa any idea why that is not caught?
 
Anonymous
I mean, why the last ouput should not be visible?
 
Because you don't catch anything?
 
Anonymous
But, the set_exception_handler does that exactly that. If it did not catch it, then where does it get the error message?
 
Anonymous
I mean, it is catching it alright ...
 
No it is not
It is handling uncaught exceptions
 
Anonymous
7:37 PM
How else is it handling it, if it is not catching it?
 
Anonymous
try{
    throw new \exception('foo');
}catch(\exception $e){
    echo $e->getMessage();
}
echo 'I am visible';
 
That is a different thing than what you are doing
 
Anonymous
it doesn't make sense. Either you try and catch exceptions, or let the set_exception_handler do it for you. In any case, both should be doing the same thing.
 
What makes you think that?
 
Anonymous
Because of the name! set_ exception_handler
 
7:41 PM
@Worf Self + derived classes is better than any possible type imo. It's not perfect, sure.
 
@samaYo It handles the exception right?
 
Anonymous
Imho, yes. It catches the exception, allows you to get the error message, and all the other details you would get from the try{}catch(){}
 
Anonymous
Maybe it's something you learn with time, and it'll make sense to me later, but right now the fact that it does not do the same thing as try{}catch(){}, seems totally wacko
 
8:04 PM
@samaYo got your xps yet?
 
Anonymous
@MarcelBurkhard not yet. Going to schaffhausen on wednesday to get it.
 
8:21 PM
@samaYo set_exception_handler() is to do any necessary cleanup. It is one of the last things executed before the script dies. It does not handle the exception where it is thrown and execution continues from there. That would be a disaster.
 
Anonymous
but it should not halt the script after the exception
 
8:33 PM
set_exception_handler handles uncaught exceptions - that means the exception has already bubbled all the way up to the highest level without being caught. If you want to deal with an exception and continue execution, you catch it somewhere!
 
8:45 PM
@kelunik Just ConnectionLimitException - exceptions don't need to be verby.
They only have to name the domain that the exception falls under.
 
@samaYo If the exception has bubbled all the way up to the top, there's no where for the script to continue execution.
 
Anonymous
don't you think there should have been a function to handle uncaught exceptions, catch them and continue ... ? as opposed throwing try and catch everywhere, we could use one handler, do switch(){} stmt inside it, and keep things going @Trowski
 
hell no
 
@samaYo Absolutely not, that completely alters the behavior of exceptions.
 
You're free to do catch(\Exception $e) wherever it would be possible for your application to continue sanely, which is normally not many locations in an application.
 
8:57 PM
The very idea of throwing an exception is that you cannot continue with the code after the throw statement.
 
Does anyone understand the open basedir directive and particularly; do extensions need to always check it manually? e.g.
	if (VCWD_REALPATH(filename, resolved_path_buff)) {
		if (php_check_open_basedir(resolved_path_buff TSRMLS_CC)) {
			RETURN_FALSE;
		}
ought to be called everywhere to respect that directive? Before passing the resolved filename to an external C library.
 
Anonymous
@Trowski Yes, I am with you. I am saying the same thing, except "What if we could have a function that catches all exception" without halting the script, if we decide to catch it.
 
Anonymous
probably my statement makes no sense, but in the code I am working right now, this would have been a super helpful idea.
 
@Danack I believe you do have to check it if you're going to be passing the path to an external library.
@samaYo What you're suggesting is non-sensical. You can't continue from an uncaught exception since you have effectively reached the end of the script.
 
@samaYo ""What if we could have a function that catches all exception" without halting the script, if we decide to catch it." - that is implemented by doing catch(\Exception $e).
 
9:03 PM
I'd have to see what you're doing, but I'm guessing all you really want to do is wrap some calls with try/catch.
 
@marcio Yeah, I saw that. Not an entirely terrible suggestion, but I'd have to think about it to decide if it would make sense. Too late anyway...
 
Anonymous
public function __construct(){
    set_error_handler(function($severity, $msg, $file, $line) {
        throw new ErrorException($msg, 0, $severity, $file, $line);
    });
    set_exception_handler([__CLASS__, "chuck_norris"]);
}

public function chuck_norris(){
    // handle but do not exist
}

public function error($error){
    return trigger_error($error, E_USER_NOTICE);
}
 
Anonymous
@Trowski something like the above
 
huh? That's the exact opposite of what we have now? @Trowski
 
Anonymous
9:08 PM
I want to show errors as, echo $class->error('error);
 
Anonymous
But without existing the script
 
o_O
 
@PeeHaa Being able to make particular type hints strict while allowing casting on others in the same file (or function even). That's very different, isn't it?
 
@Trowski there was a similar suggestion during discussion phase, just with a different syntax
 
@Trowski The problem is that you cannot have non strict that way ever
Because it is defined on the "other side"
 
9:11 PM
It's pretty bad - it makes correct code be harder to both read and write.
 
Unless I'm misunderstanding the commit, the idea is that string would be non-strict, and string! would be strict (I don't like the ! syntax, but that's what the comment used).
@samaYo Again, where would the script continue from? set_exception_handler() only is called for exceptions that bubble up to the very top level, i.e. main.
 
Anonymous
ok, but any alternatives for that example to work?
 
@Trowski Yes but you define it in the function/method signature meaning you cannot interface with it in a non strict way ever
 
@marcio answered cc @Trowski
 
@PeeHaa Ah, ok, that makes a lot of sense.
 
9:23 PM
"~80% of my php7 code is strict now and my test suites decreased by ~20% at least" - says happy declare(strict_types=1) customer
 
@FlorianMargaine @Danack @PeeHaa Yep, I agree it's much better the way it's currently implemented. Commenter had an interesting idea, but would have been messy.
 
@marcio then your tests are bad :-)
 
The only that could be improved with the current situation is to allow strict to be the default...I don't think that many people will make a conscious choice to use the coercive mode.
 
@bwoebi nope
 
@bwoebi you're lacking imagination bob.
 
9:26 PM
@Danack Yeah, I even don't want to imagine these horrible now superfluous tests.
 
function foo($x) {
    if (!is_int($x)){
         throw new InvalidArgumentException("blah blah");
    }
    //actually useful code.
}
Just basic type checking...
 
^^ I don't miss this
 
@Danack I look forward to never writing code like that again.
@samaYo What you're looking for is simply a try/catch block. It implements exactly the behavior you're looking for. I'm struggling to understand why you seem opposed to using them.
 
/ flashback of ruby users trying to test their private functions directly pops
 
@Trowski what he's looking for (it seems to me, anyway) is a try/catch block around every statement, that calls a callback function... without having to do that himself.
 
Anonymous
9:33 PM
^^
 
To which the answer is, oh hell no. :P
 
@Danack that's not strict types related. For that normal coercive types are enough.
 
@samaYo Then there's something wrong with your design. Rarely should you need to have a series of statements with a try/catch block around each.
Examine how you could push some of your logic into functions or a class.
 
Anonymous
@salathe cast you to hell :)
 
@salathe @samaYo yeah, definitely oh god no.
 
9:38 PM
@bwoebi this is wrong in so many ways 3v4l.org/tA7L0
 
@marcio meh…
 
At least this issues a warning, that makes me feel better.
What's the status on type-hints like int|null. I've been doing that sort of thing a lot.
e.g., int if you want to read a certain amount of data, or null for unlimited.
 
@Trowski postponed for 7.1, @LeviMorrison wanted to RFC it.
@Trowski in that specific case, I recommend using -1.
 
@Trowski good times when monkeys were automagically casted to bananas
 
@marcio yeah, being a wizard felt great.
 
9:45 PM
that's why you don't have tests, right? :P nostalgia
 
@bwoebi That's not a bad idea. I also have cases where I'd like to use string|null, suppose I could go with an empty string instead.
 
@Trowski an empty string is fine as long as an empty string isn't a valid value by itself.
But there are always reasons to use string|null. you just can avoid them often in favor of simpler solutions.
It's a good goal to avoid type mixing as much as possible, but sometimes it's just a better and simpler API with them.
first KISS, then everything else.
 
@bwoebi I generally avoid mixing types, but I often allow null if it makes sense for the parameter.
 
@Trowski null is also a mixed type. Maybe not that strong, but still.
 
@bwoebi It is, but PHP allows null for parameters with type-hints, so it seemed to make sense. e.g., callable $callback = null
 
9:52 PM
@Trowski for optional types, definitely an option.
well, especially for optional objects (and callables)
 
@bwoebi Yes, null makes more sense for objects vs. an int.
 
@Trowski the only case to allow null on an int is when there's no value outside the range which could mean something else.
but for generally positive values, using -1 as alternative is nice.
 
@bwoebi I agree. I think I'll have to change this interface a bit before I release v1.
$byte can be string|int, maybe I'll just have to go with string only until 7.1 lands. I don't see too many people specifying a byte by int value anyway :P
 
@Trowski yeah, you could change $length to twice accept -1.
@Trowski well, $byte is a classical example where null makes sense
 
@bwoebi Hmm.... yeah. Well, I guess all parameters just won't have type-hints then.
 
10:02 PM
@Trowski as long as you're supporting 5.5/5.6, anyway not.
 
@bwoebi My plan was to release a v1 for 5.5+ and a v2 for 7 simultaneously.
 
@Trowski yeah, then just leave out the typehints where 7.0 doesn't support them.
@Trowski Also, suggesting you to use v1.1 for 7.0 ^^
 
@bwoebi Reason?
 
@Trowski the two versions are compatible … so when someone specifies 1.x in his composer.json, he'll just get the most compatible one.
 
@bwoebi I see. I had planned on enforcing using return in generators to return values for 7, so that would make them incompatible.
 
10:08 PM
@Trowski I wouldn't enforce it but make the two ways coexist…
 
@Trowski I typically specify a byte by int value, sorry :P
 
@bwoebi It leads to ambiguity though. If I get null from $generator->getReturn() do I assume then that I should use the last yielded value?
 
@samaYo , so what you decided about you JS studies ?
 
@Trowski eih… yielded values are anyway promises or return value, no?
 
@FlorianMargaine Good to know, and that's why I made it available. I think I'll leave it then. Usability should probably outweigh my desire for type-hints. :)
 
10:11 PM
so, if the last value wasn't a promise and return is null… yes.
 
@bwoebi It is possible the last value is a promise and return is null.
Then the return value is the resolution of the promise.
 
can I ask question about Remote IIS?
 
@Trowski phew… Amp solves it by having yield "return" => $retval;
instead of weird meanings of last ^^
 
@bwoebi Amp used to have all sorts of meanings for generator keys.
I'd have to look how it's implemented, but you might also have a bug related to finally.
 
@Trowski used to. yes. We realized it was a bad idea. But return key is the only way to have an unambiguous retval.
@Trowski just don't yield in finally. that's inviting for bugs and unexpected Exceptions.
 
10:16 PM
@bwoebi Actually I'm referring to the finally block not being executed at all.
 
@Trowski ??
 
Does Amp always run the generator until $generator->valid() is false?
 
@Trowski Finally blocks will be run even if the generator does not finish execution
 
@NikiC When the generator is destroyed?
 
^ and throw an exception when you yield inside a finally called in the "destructor" of the generator.
 
10:18 PM
Yes
Though I dare say this is an exceedingly badly tested feature ;)
 
That's interesting, because my testing showed otherwise.
I originally played around with Recoil and it wouldn't execute finally blocks.
 
lol, maybe it wasn't tested at all ^^
 
@bwoebi hm?
 
@NikiC Maybe my testing was flawed then, or there was something going on in Recoil I didn't understand.
 
The exception I mentioned earlier today was because of a return; in catch and a yield in finally.
 
10:26 PM
@kelunik that's what I meant
 
3v4l.org/47AHU This blows up, which won't happen in Icicle with the way I implemented Coroutines.
 
@bwoebi It's not an unexpected exception nor really inviting for bugs.
 
@Trowski Oh and of course it only works if destructors are actually run
 
@kelunik it's unexpected when you don't know that.
 
@bwoebi When you think about it, it's quite clear.
 
10:28 PM
@NikiC Interesting. Again, my testing must have been flawed or Recoil was doing some craziness.
 
nobody uses finally blocks anyway
:P
 
@NikiC very true ^^
 
@NikiC I do :P
 
I never use finally blocks in PHP.
 
Not often... but I don't like subtle gotchas in code.
 
10:29 PM
@bwoebi try { .. } finally { .. } :-P
 
@kelunik catch the damn thing…
and rethrow if necessary
 
Catch, cleanup and rethrow?
 
@bwoebi So then you have to have the cleanup code twice. Isn't that the point of a finally block?
 
It is.
 
oh, sure. But I never have such a situation…
 
10:30 PM
I guess I'm just not that cool :P
 
@bwoebi Did you write app code in the last time? You may not need it in library code.
 
@kelunik Aerys is an app :-P
 
@bwoebi Nope, sorry, doesn't count :-P
 
haha :-P
 
If I released a v2 that required PHP 7, would composer fall back to v1 automatically if someone ran composer require icicleio/icicle using PHP 5?
 
10:36 PM
@Trowski the point is not having libraries needing two versions
 
@bwoebi The reason I'm not crazy about v1.0 being compatible with 5 and v1.1 requiring 7 is that what happens when I want to introduce a new feature... now do I go to v1.2 and v1.3?
 
Hmm… well… just make 1.0 PHP 5 compatible and new features are PHP 7 only
 
@Trowski Or new features require 2.0 and 2.1 as version numbers.
 
or that.
 
Yes, because fuck people who are can't upgrade to a new major version of PHP straight away.
 
10:41 PM
@kelunik That's a possibility. I was going to reserve major version numbers for BC breaks, but that's not out of the question.
 
@Danack who can't? They can. You even can have multiple PHP cli binary versions installed.
 
To me it makes sense to have v1 = PHP 5.5+ and v2 = PHP 7. I'd back port features that could be back ported to the v1 branch.
 
@Danack especially as apps using event reactor are most likely cli based.
 
@Trowski Technically yes, in practice that would almost certainly be quite annoying.
 
(I say most likely. There exist some, but that's a minority.)
 
10:44 PM
@Trowski And even when you stop back-porting new features, still being able to do bug-fix releases for a 5.x version is nice.
 
@bwoebi You do have some point there, but so many developers I speak to have little control over the version of PHP that they have to work with.
 
Bob thinks that upgrading an application to a new major version of php could cost a few thousand dollars max.
 
@Danack no.
I think it depends.
On size of app and on amount of legacy.
 
@Danack Exactly. Though apparently it would be annoying with Composer? Not sure what you meant by that.
 
Feb 3 at 20:33, by Danack
"If I pick 5.6 today, I have more than 2 years…" Imagine if you pay a team half a million dollars to develop an application for you. Would you be happy to throw it away after 2 years?
 
10:45 PM
@Trowski sure. But you aren't going to integrate an event reactor into a full blown existing application. You rather start a new one.
 
Feb 3 at 20:34, by bwoebi
@Danack Yeah, you need to pay a few thousand dollars then... And distros anyway have LTS, so…
 
@Danack sure. For a 5.6 app. Yes (maybe a bit more, but not a lot). For a 5.2 app, definitely not.
 
@bwoebi That's certainly true. Icicle is meant to be a reimagining of how PHP apps are built, so most people using it aren't going to be mixing it with old code.
 
@Trowski Composer has terrible error messages when something can't be installed....one that's particularly annoying is when i) there is a new version of a library available ii) it has a dependency that can't be met or clashes with another library. What happens is that composer happily installs an older version....which can mean that people are missing out on bug/security fixes.
 
@Trowski and then it's maybe better to just start with PHP 7 straight away…
 
10:50 PM
@Danack If it can't install the newest version because of an incompatible PHP version, it won't automatically fall back to the older version?
@bwoebi That might be too limiting, I'd have to think about that...
 
do we have xdebug for php7 already?
 
@Trowski I say maybe. It's just a thought for you.
@marcio I think Derick is working on it… but phpdbg is enough for me^^
 
@Trowski Possibly, but that sounds bad to me. Having versions change dramatically based on which PHP is installed sounds like surprising behaviour.
 
@bwoebi does phpdbg can be used to generate code coverage report?
then I still miss xdebug :x
 
@marcio no… but we could add it.
 
10:53 PM
@bwoebi that would be awsome.
 
I mostly use xdebug for the profiler tbh
 
@marcio Not sure it's even been started...
 
@FlorianMargaine there are other extensions like xhprof better suited for that IMO. But adding a profiler to phpdbg would be really easy.
 
I'm not saying it should be in phpdbg... it shouldn't imho
 
@Danack PHP 7 just has too many awesome performance boosts for me to use the same code-base for both versions. I just want to find an elegant way to maintain both branches and make it easy for people to install.
 
10:55 PM
@FlorianMargaine shouldn't be in xdebug either IMO ;-D
 
but coverage in phpdbg is a great idea.
 
really? it's more of a testing feature imo...
 
I'd already like to have a PHP 5.6 branch to use variadic functions. :)
 
@FlorianMargaine coverage is also a great way to find the execution path of your process…
coverage really just is calculating the data together.
@FlorianMargaine and execute path of a process is indeed a debugging feature… which you can misuse for coverage ;-D
 
11:01 PM
hm... how would you generate such a report with text?
 
Not sure. Need to first analyze how that works exactly ^^
 
@Trowski What you said earlier, just having separate 1.x for 5.6 and 2.x for 7 would be fine, so long as people add the require with ^1.2.3 to continue getting that version.
 
@FlorianMargaine immo it should just export the data and another command should be used to render the coverage
coverage report with cli interface won't be very useful
 
@Danack Ok. I'll think about my options and see what would fit best. Thanks for the input.
If I could have tags such as v1.0.0-5 and v1.0.0-7 that point to different repos that would be ideal.
Not sure if a version constraint like ^1 would work with those tags... probably not.
 
Different repos? I doubt that's possible with composer.....
 
11:11 PM
Sorry, not repos, branches.
I don't see why that won't work, unless Composer considers tags with dashes as dev versions.
 
@Trowski you could simply have a different php version in the composer.json on each branch
not sure how composer would handle that though...
 
@Trowski That would break when people want to install stable versions. It would also not be possible to do a bug fix on the 5.x version without doing a ghost release on the 7 version as 1.0.1-5 would be > 1.0.0-7.
 
@Danack Hmm... eww... Though not impossible to maintain. Especially since most of the code would be the same.
 
Just using different major versions is a sane way to do it. Though you could also encode what version of PHP the library is for in the library name i.e. 'Icecicle7' - as that allows different versions to be installed alongside each other, which is nice for testing.
 
11:27 PM
@Danack I'd like to avoid such a big separation. Ideally if someone upgraded to PHP 7, composer would automatically grab the PHP 7 version when they ran composer upgrade.
@FlorianMargaine I'll watch that.
 
00:00 - 19:0019:00 - 00:00

« first day (1688 days earlier)      last day (3266 days later) »