logs archiveIRC Archive / Freenode / #php / 2015 / November / 20 / 6
__adrian
also, in order to catch such an exception (and wrap it, so it conforms to the method's signature), i'd have to add another catch( errorexception ), and it wouldn't be immediately obvious where an errorexception came from.
AcidReign
__adrian: oh you could map errors to specific exception classes
I've done it
parse the error message in the default error handler, then throw new IncludeException or whatever
__adrian
you only get one user error handler with set_error_handler, right?
AcidReign
yes, afaik
I've never tried to have two
__adrian
same. reading docs and i'm pretty sure.
AcidReign
but I guess you could contrive something similar to SPL's register autoload mechanism
__adrian
so for portability it'd be the same problem: relying on that error handler, or setting one just for this method
hehe... error_handler_register
AcidReign
well you'd set it as part of your application/framework's bootstrap code
__adrian
yeah. for me, not a problem, but for portability/modularity... especially the util module, I want to be as independent as possible
         

AcidReign
__adrian: oh if this is just for a library then it may not really make sense, I was thinking in an application or framework
__adrian
yeah, i want to hit both uses
do you dislike // establish known error state as much as i do?
and aside from that do you see any possible complications with it?
AcidReign
the problem with suppressing errors just before you include, is it stays suppressed for all the code in the included file
is that actually what you want?
__adrian
ooohh.. hadn't thought of that.
nope. that might screw with whatever plan the module had for error handling.
AcidReign
__adrian: this feels like a framework problem, not a library problem
__adrian
so take out the suppression and let it fall where it may
AcidReign
you're trying to define something about the environment, rather than accepting whatever, or allowing things to be configured
frameworks do that, they create the environment, but libraries shouldn't
[IMO]
__adrian
i still really want to throw, deliberately, if include fails
(i get what you're saying, and agree.)
AcidReign
__adrian: then set the handler before, and unset the handler after
__adrian
you think that's better than this?
AcidReign
__adrian: only trap include errors, and maybe even inspect the exception before you throw to make sure it originated from your Loader .... that maintains the outer environment
__adrian
(Action) nods thoughtfully
AcidReign
__adrian: also be aware of the current error_reporting state, the error handler is called regardless of it's value
__adrian
oh!
AcidReign
that bit me once, I didn't realize you had to check and account for it manually
__adrian
no, nevermind
sorry, "the current error_reporting state"?
AcidReign
meaning you could have error_reporting(0) [off] and the handler is still called, you have to check inside the handler to see if you should ignore the error level
__adrian
you mean error_reporting level
AcidReign
yeah
__adrian
hm.
         

AcidReign
eg, you have a handler that throws ErrorException on everything, now the value of error_reporting() is completely ignored
and Notices will always be exceptions
__adrian
i want this to be perfect, but at the same time i am sure starting to see the diminishing returns
AcidReign
__adrian: perfection is a flawed concept :)
__adrian
:)
i am going to bed. thanks very much!
AcidReign
__adrian: :)
good night
shibly
form preview before submit, is it with javascript or with php? Can anyone post a link with example?
MrXXIV
I need help with some math, are these the right percentages? http://pastebin.com/R6dJuPe3
NiLon
looks like correct
Bad_Advice_Cat
NUuuuuuUU. __adrian was going to achieve perfection >.<
asterismo
hi
if i have this in form.php
<input type="submit" name='submit' value="SEND">
and this in process.php
if(!isset($_POST['submit'])){ echo "Error, must fill the form first...";}
i get the error after pressing the send button
hows that?
sorabji
var_dump $_POST, what's in there?
asterismo
where do i insert that=?
should i echo that ion the process.php?
sorabji
wherever you expect $_POST to have that value
asterismo
if (!empty($_POST))
means if $_POST is not empty, right?
sorabji
yes
asterismo
so i could use this instead !isset
sorabji
they're not the same thing
Alphos_
$_POST is very frequently set, even at times when you don't expect it such as during a GET request
Bad_Advice_Cat
asterismo, you might like this idea: https://gist.github.com/adrian-enspired/50591f70d1d88b83383c
An elegant way to get variables from the $_POST superglobal. You can use this same technique with $_GET as well.
TML
that's not...*sigh*
Bad_Advice_Cat
(Action) pokes pokes pokes TML :D
wannabegeekster
Ugh for some reason I cannot figure out what redbean returns when using the find command.
array(1) { [284]=> object(RedBeanPHP\OODBBean)#15 (10) { ["properties":protected]=> array(36) { ["id"]=> string(3) "284"
How am I supposed to get to the id field there?
fleetfox
id in object or id in array?
it returs objects indexed by id
wannabegeekster
id in array
strangemeister
wannabegeekster: the source on github says to use the method OODBBean::getID()
wannabegeekster
or any of the resulting variables
fleetfox
wannabegeekster: you can do key($array)
it returns collection, so access one ide makes little practical sense
wannabegeekster
Thanks for getting me in the right direction
hxm
hi
i receive this error "PHP Catchable fatal error: Object of class SendMail could not be converted to string" but the job is done and i dont find any error
the ajax request wont success because the result is an 500 error
watmm
You you're hitting what is already a high value for max_children without a significant increase in memory usage, could that suggest that you should lower pm.max_requests?
^ IF you're
jani_
hello.
how can I set the my custom html <body> tag in php. I want to add a class to the body tag and that class will be dynamic based on some database value.
is there any way to do this?
I have a controller's action and I want to set the <body> tag in that action. and that is the only option with me
asik
echo "<body tak="">
?
jani_
I can't do this. and it is nor working.
asik
ask the support for that framework or whatever you use
jani_
how html will replace this echo "<body tak=""> with its default body tag. in whole project.
asik
html will do nothing its a markup language
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 next »