« first day (1125 days earlier)      last day (3828 days later) » 

12:07 AM
@Danack Thanks very much for the link! I couldn't find that at all. Note to the world: using PDO for secure MySQL data input is MUCH easier than MySQLi
Night all.
 
@HelpingHand Hmm - wait til you find the gotchas.
"When in emulation mode (which is on by default), PDO substitutes placeholders with actual data. And with "lazy" binding (using array in execute()), PDO treats every parameter as a string. As a result, the prepared LIMIT ?,? query becomes LIMIT '10', '10' which is invalid syntax that causes the query to fail."
 
I'm looking for someone who would be willing to help me design a relative mysql database, i'd be willing to pay
 
12:28 AM
10
Q: Chat room stars, personal vs. room

Dan LuggContinuing with the frustration from this question, I'm wondering if a distinction between personal stars and room stars would help manage the way we mark content as "interesting". While there aren't any specific guidelines on star etiquette (please correct and link accordingly if I'm wrong), t...

^^ it's been closed as a duplicate; I think I'm going to need to appeal this.
 
12:51 AM
@DanLugg I agree. Particularly since the question that was marked as a duplicate isn't really the same feature at all
 
1:03 AM
can any one helps?
0
Q: how to get vistors_sum and reviews_count in 3 table?

mingfish_004how to get vistors_sum and reviews_count in 3 table ? see the bellow codes, how to get my result in one sql? SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for `a` -- ---------------------------- DROP TABLE IF EXISTS `a`; CREATE TABLE `a` ( `products_id` int(11) ...

 
1:21 AM
Hi
 
hey hey
So would any of you care to critique my work?
 
@JoeWatkins @ircmaxell is it acceptable to bump a thread on internals if it has been ignored?
it's been 5 days since I requested review on use-function and nobody has replied to it
 
1:38 AM
hi
 
2:38 AM
I'm looking for someone who would be willing to help me design a relative mysql database, i'd be willing to pay
is anyone willing to help?
i need a custom cms
 
@Michael I need a turkey sandwich
 
@SomeKittens not a problem, where should i send it :)
 
@Michael Seems the mayo might spoil.
 
@SomeKittens i'll include a packet of mayo so you can add it yourself
lol
 
what is "relative mysql database" ?
 
2:55 AM
@igorw yes
 
3:15 AM
Didn't you leave Internals?
 
Good Morning Everyone
 
Morning
 
3:41 AM
morning
 
4:06 AM
hi
 
@crypticツ I have been watching ur discussions related to php security, Could u plz refer me some good books related to security.. I recently finished reading Essential PHP Security
 
user652649
morning
 
4:25 AM
@ShowketBhat I stick to OWASP guidelines
 
@crypticツ I usually read them, but not so frequent...
 
@ShowketBhat this is what I usually link people to owasp.org/index.php/OWASP_Testing_Guide_v3_Table_of_Contents
 
@crypticツ Cool
This is mostly with Quality assurance
 
5:27 AM
do we need to use beginTransaction for single query ?
(INSERT,DELETE,UPDATE)
 
@Wes i have two class methods
both have two insert queries separately
i'm normally get the first one response and if it TRUE execute the 2nd INSERT
how do i wrap both two methods into the beginTransaction
 
user652649
at the beginning, before any query you call beginTransaction()
 
//sync log generatting from here
    public function getLog($table, $Sync_query)
    {

        try {

            // First of all, let's begin a transaction
            $this->done->beginTransaction();
            $sql = $this->done->prepare("REPLACE INTO " . $table . "(Sync_query,Sync_Time) VALUES (?,NOW())");
            $sql->execute(array(
                $Sync_query
            ));
            // i.e. no query has failed, and we can commit the transaction
            $this->done->commit();
 
user652649
then you do the first query, if it's ok you run the second query, otherwise you call rollback(), if also the second one is ok you call commit(), if returned an error, you call rollback()
 
5:41 AM
that is my 2nd method
how to use two methods with that ? Wes
 
user652649
are you sure all errors will go in the catch?
 
i don't know
php.net/manual/en/pdo.transactions.php example showing something like above
 
user652649
i mean, do you need additional checks?
 
user652649
like counting the affected rows?
 
yes
@Wes u there?
 
user652649
5:56 AM
yes i am, i was expecting you to say something
 
user652649
what check you want to do?
 
user652649
if that is the actual code you don't more i guess, but i don't know pdo much
 
first query success
 
user652649
but the transaction seems fine
 
the insert 2nd
if both fail roleBack
if both success commit
 
user652649
5:58 AM
shouldn't be if one of them fails rollback?
 
but how to do it with using two class methods ?
yes @Wes
if 2nd fail or 1st fail
 
user652649
what do you mean with two class methods? which are those methods? are you sure you designed them well?
 
user652649
because looks suspiciously wrong
 
user652649
or you just may want to beiginTransaction() in constructor and rollback|commit in destructor
 
@Wes woah, no, bad idea. Constructors should just create the object.
what if you want to call the method twice, derive from the object, have other objects with transactions.
the lifetime of an object isn't always clear
 
6:08 AM
0
Q: How to resolve session issue with cms in magento?

DRAJII have created one cms page for showing coupon code information in magento. sucessfully created. But when i open that cms page, it will be opened another user acccount's coupon information. But other liknks are working correct. In the url(http://www.example.in/coupon/), if i put "/" at the end ...

 
@Paul i just need to send another query if the first one success
 
user652649
@Paul you are probably right, a better explanation of the class' purpose would help @samitha
 
if both fails i need to rolaback both
now i used two class methods
 
user652649
@samitha the point is, your second method depends upon the first one's call?
 
yes
also i have a lot methods
 
6:10 AM
try
{
$pdo->beginTransaction();
if ($object->methodOne()) // No transaction code inside.
{
$object->methodTwo(); // No transaction code inside.
}

$pdo->commit();
}
catch (...) {}
 
user652649
it's generally wrong having methods of the same class depending each others
 
user652649
except few cases
 
yeah, I agree with Wes, it does sound like a design issue, you should probably expose the super method that does methodOne and methodTwo for you.
 
user652649
yes
 
user652649
or it may be a case where nested transactions are needed
 
user652649
6:17 AM
innodb doesn't support nested transaction yet, right?
 
yes
 
user652649
pastebin the class @samitha
 
7:00 AM
@ircmaxell I have a string "kUcoRy" that's generated from a string "linkgoron", I want to know how that generation went - I have a few more such samples. How do I go about that?
 
7:53 AM
Goodmorning!!
 
Good morning everyone.
 
morningz
 
Yey, Almost finished with the Laravel CodeBright book.
 
8:18 AM
good morins
 
Hi @iroegbu
 
8:37 AM
hi this is sachin , i am a php engineer from mumbai
 
:D
 
morning
 
Morin =]
 
8:54 AM
If I have a bunch of methods that all require a $url variable, let's say I use the constructor to pass/set $this->url; so all the methods can use it, how would I make it so that I can either pass it through the constructor and use $this->url; Or simply not pass it through the constructor and use a new $url directly on the method?
basically if $this->url; is set use that, if not use the one passed through the method.
 
function foo($url = null)
{
    $usedUrl = $url !== null ? $url : $this->url;
    // …
 
@Gordon wouldn't this be a use-case for your auto-prop init RFC?
 
@Fabien see above
@crypticツ nope. since its conditional
 
methodName($url = $this->url) like that won't be allowed with it?
 
9:00 AM
@crypticツ it's about methodName($this->url)
 
another RFC? =oP
 
@crypticツ feel free to create one :-P
 
I suck at writing documentation
 
@Gordon Ah fair enough, I thought there might be something that exists for this case but conditional it is.
thank you
 
I'd like to see that one, but I have no idea how to implement that without invoking zend_execute…
 
9:02 AM
I think here is one for somthing like __construct($this->memberVariable)
 
@crypticツ that's the least problem… If you have a patch I'd be happy to write the rfc :-D
 
I don't know C =o(
 
learn it, it's not hard
:-P
 
@bwoebi is that a performance issue?
 
@crypticツ yes: extra-oparray, extra-execute-data, extra-opcodes etc.
and not a clean way.
because then at the end we need to destroy the extra oparray etc
 
9:13 AM
 
Morning
 
Do we have commit notification based on user in svn Commit Monitor?
i need notification when someuser commits the file... eg
show notification only if commited by x,y,z people
by username
 
morning @AlmaDo and @Jimbo
and @AshwinMukhija
 
@Fabien :)
 
9:18 AM
what do you think
5
Q: Benchmark memory usage in PHP

Alma DoSO, Specifics Let us suppose that we have some problem and at least two solutions for it. And what we want to achieve - is to compare effectiveness for them. How to do this? Obviously, the best answer is: do tests. And I doubt there's a better way when it comes to language-specific questions (f...

//may be I'm asking on SO too often :p
 
fyi: echo(a,b); is a parse error while echo a,b; is not. — bwoebi 6 secs ago
 
hm, hm..
copy-paste isn't good :p
 
I think Selenium can be configured for memory usage stats.
 
@bwoebi echo is not a function :-)
 
there are tips for xDebug in answers. Will it work? Can I do automatic test for function memory usage with it?
 
9:30 AM
I hate naming things... namespace for JSON-RPC... can't have "-", "JsonRpc" feels wrong, "JSONRPC" equally so... sigh
and "_" breaks legacy classes in the autoloader
 
Can someone help me out with mCrypt?
 
@AlmaDo you got another answer
 
@Leigh JsonRpc doesn't sound that bad to me...
 
Is this looking ok?
Or not at all?
 
@webarto It's the same annoyance with Http, when you know it's HTTP
 
9:40 AM
Or Sql :)
I know.
 
@bwoebi huh, declare is thing in PHP that I've never understood :( - but I'll try to do that
 
@Duikboot You should hash password, not encrypt.
 
hmm
Why is mcrypt then used
 
@AlmaDo it's not hard ;-)
 
Sensitive information
 
9:42 AM
@bwoebi may by manual page is not well for me :\
 
@Duikboot I don't know, take a look at: github.com/ircmaxell/password_compat
 
@AlmaDo If you encounter problems, just ask :-)
 
@webarto Is that hard to implement?
 
@webarto The only thing lacking in password_compat is autoloading, imo
 
@bwoebi I just don't understand what this construction doing :D
and how I can apply it in just any script
 
9:46 AM
But usingn mCrypt for passwords is not good?
 
just write at the top of the script: declare(ticks=1); register_tick_function(function(){…thecode…});, that's all.
 
@AshwinMukhija I don't think so, it's one file, it's not a class, etc. You can just include it.
 
@AlmaDo erm, oops it's declare(ticks=1);
 
yeah, I see this sample in manual
 
@webarto I'm aware of that. I can also see how it would provide similar functions as the password_* library does.
 
9:49 AM
@bwoebi will I be able to do that inside function? (I guess not)
 
@AlmaDo no
but you can set a gloabl variable inside a function which the tick handler checks if it's set
 
I think I am misunderstanding.
What do they say? 1. php.net/manual/en/faq.passwords.php crypt? then hash?
 
@bwoebi but what is tick and tickable ?
 
There is no option in my situation to use bCrypt.
 
e.g. register_tick_function(function() use (&$memchk) { if ($memchk) {…thecode…}}); and in the function you call: $GLOBALS["memchk"] = true;
 
9:51 AM
what does mean tick? Line of code? execution of opcode in VM? or what?
 
What does it mean when you call a function like this: some_func($var = 'some string')? Is it the same as some_func('some string')? If not, how is it different?
 
@AlmaDo a tick = tick counter is incremented; a tickable statement = a statement which isn't a statement which can be only at top-level.
 
@AmalMurali for inside function is's same if function expects value. But if it expects reference, that will be error
@AmalMurali and in outer scope, difference is obvious - you'll create $var with certain value
 
@Duikboot You need to move off VPS is security is a concern.
 
@AlmaDo e.g. a(); tick(); if ($b) { print 1+1; tick(); } tick();
 
9:53 AM
Is this for you or your employers?
 
@Duikboot The only time you should be using mcrypt for password hashing is to generate a salt.
 
@AlmaDo: "for inside function is's same if function expects value. " -- sorry, I didn't get you. Could you explain?
 
And, they are talking about using either the crypt() or the hash() function to generate password hashes
 
Ok let's do that but what is your process to store passwords in the DB?
 
@bwoebi your explanation about tickable statement not confuses me even more .. I'm lost :\
 
9:54 AM
 
I've seen that presentation already :) @Fabien thanks
 
is that ircmaxell?
 
Yeah
 
yes
 
9:55 AM
@AlmaDo actually it's ± that what you describe a code line^^ (a semicolon terminated statement and a few things more)
 
@Duikboot Is this your own project or for work?
 
both, >< I went on project where they use MD5 only...
 
Oh good lord
 
WHo pays the hosting?
 
@AlmaDo btw. that's not important, just try it :-)
 
9:56 AM
Hosting is no problem.
 
It is if you can't upgrade to a version of PHP which supports password_compat at least :P
 
I am on a VPS.
 
@AmalMurali this
 
What PHP version?
 
What version of PHP do you have @Duikboot
 
9:57 AM
5.3.2 or something right?
 
Unless you are sure having PHP 5.3.7+, use crypt()
 
@bwoebi I don't want use something if I'm not understanding it. Also, if there's a thing that I din't get, it's sad for me so I'm trying to understand
 
Well this project is running on 2 hosts:
1: PHP Version 5.3.23
2: PHP Version 5.2.6
On the second one it's not possilbe to move to a higher version.
 
are they necromancers?
 
And the first one looks ok to me.
 
10:00 AM
@AlmaDo what exactly a tickable statement is something more internal. As said a tickable statement is a statement after which the tick counter is incremented. And these statements are most things which end with the semicolon.
 
If you were in this situation what solution should you think off with this setup?
 
And if tickcounter % n == 0 the tick handler is executed with n stemming from declare(ticks=n);
 
@bwoebi ok, if I'll do foo(); bar(); - what will be increment? 2 or it will go into functions?
 
hash('sha-512', $plaintext) is the most basic way which is not retardedly easy to break.
 
@AlmaDo the execution is: foo(); tickhandler(); bar(); tickhandler(); if you do declare(ticks=1);
@AlmaDo if you do declare(ticks=2); it'll be foo(); bar(); tickhandler();
 
10:02 AM
@bwoebi but will it go inside functions?
I understood what N means :p
 
@AshwinMukhija So that's the best thing I can do?
adding a salt with mcrypt can help?
 
@AlmaDo inside of the functions there will also be ticks, yes.
 
No. You can use crypt() with a salt.
 
@bwoebi good. Now, what will be for N=1 with this code: foo(); ; bar(); actually - 3 or 2 ?
 
3.
; is also a semicolon-terminated statement.
 
10:04 AM
like I've though
so actually, I'm understanding this now a little
now I'll go to your answer and try to understand it :p
 
:-)
 
In wich steps would you do it? hastebin.com/qifeqoreku.php
:P
Im not familiar with this yet.
 
For starters, just use $hashedPassword = hash('sha-512', $_POST['password'])
 
I would like to add a salt
 
Take a look at openwall.com/phpass
Instead of writing the whole thing yourself.
 
10:11 AM
does anybody know much about mocking in unit tests?
 
@AlmaDo: yeah, but what exactly is the difference between the two? (other than the error you posted, and the scope) I don't see a use-case for some_func($var = 'bar'). When is it used?
 
hmm
How safe is hash('sha512', $password); ?
 
@AmalMurali 'difference' and 'use-case' are different questions. I believe I've shown you the difference. Why using that - is up to you
 
Is:
$hashedPassword = hash('sha512', $password.$salt);
More safe then:
$hashedPassword = hash('sha512', $password);
 
@AlmaDo hmm, is there a manual reference somewhere? I'm unable to find it. :/
 
10:15 AM
@AshwinMukhijaUsing phppass is not an option I think... i have to explain this to a md5 user who is not aware of the risks
 
@bwoebi huh
you're not fully correct :p
@AmalMurali why reference? what's unclear? :p
 
@AlmaDo explain?
 
@AmalMurali difference is that you're assigning var
assignment is an expression
 
and result of that expression is passed to function
but side-effect of such expression is that you'll get assigned var
 
10:17 AM
MD5 is fast, so it can be broken very quickly with bruteforce
 
@bwoebi I've created what I want
 
@AlmaDo ?
 
SHA-512, on the other hand, generates a few thousand hashes per second, so it is considerably slower. Blowfish is even slower, and hence more secure.
 
@AlmaDo: why is that assignment necessary? You can simply so some_func('some string'); as normal so why do you need $var = part?
 
So, for starters, use hash() with SHA-512
 
10:19 AM
@bwoebi this is my answer:
function benchmarkMemory(callable $function, $args=null)
{
   declare(ticks=1);
   $memory = memory_get_usage();
   $max    = 0;
   register_tick_function(function() use (&$memory, &$max)
   {
      $memory = memory_get_usage() - $memory;
      $max    = $memory>$max?$memory:$max;
      $memory = memory_get_usage();
   });
   $result = is_array($args)?
             call_user_func_array($function, $args):
             call_user_func_array($function);
   //unregister_tick_function(); //what will be the name? do I need that at all?
@AmalMurali you don't need it in function. But you may need this in outer scope
it's a short way to do: $var = 'some_string'; foo($var);
 
@Duikboot still ignoring php's password hashing api?
 
@ThomasWeinert I don't think he has access to even password_compat
 
@bwoebi declare works well inside function
 
@bwoebi but do I need undeclare_tick_function() ?
 
10:21 AM
@hohner some
 
@ThomasWeinert well that answers my question :)
 
@AshwinMukhija only condition is that you have ext/crypt, I am stuck with PHP 5.2 compatiblity and use it.
 
crypt is a part of PHP core, and most systems even have hash
So, he should have access to both
 
@hohner well, ask a more specific one :-)
 
And, upgrade your PHP version. :)
 
10:24 AM
@bwoebi also, will that affect ticks in outer scope(s) ?
 
@AlmaDo yes, ticks are global
 
so I need to do undeclaring ticks function?
 
@AshwinMukhija I said compatibility not that I use that version
 
@AlmaDo yes
 
@bwoebi so I can't use closure? :(
 
10:24 AM
Ah, yes.
 
register_tick_function($func = function…); ……… unregister_tick_function($func);
@AlmaDo you can, see above
 
@bwoebi no
 
I'm paying half attention to the chat and half to the cricket match.
 
@bwoebi unregister_tick_function expects string
so that will be fatal error
the only way to do that is to define function (normal one) - but I want solution in one-piece :(
 
@AlmaDo a string? not a callback? aaaargh
 
10:27 AM
@bwoebi yes. this is sad, but... it tries convert closure to string
and so it's very sad :(
 
btw, what do you guys think of Foundation
 
:)
I've invented other way
 
Morning all
 
@SweetieBelle Morning
 
10:31 AM
@ThomasWeinert Can you give me an URL?
 
@AlmaDo you got a nice question badge :-)
 
@bwoebi huh, not first time :p
 
Morning folks.
 
hi, @SweetieBelle @DanLugg
 
How is everyone?
 
10:34 AM
Off hand, what's the most reasonable way to appeal a moderator close on a question?
 
@bwoebi my current sample is not working :(
 
@AlmaDo code?
 
@bwoebi here
 
How secure is this solution? hastebin.com/vusotufuku.php
 
10:44 AM
@AlmaDo max isn't passed by reference
 
?
 
register_tick_function copies $max and then passes it's internal copy by ref to the tick handling function
 
Hello,
Is it possible to find the WSDL URL of a web service, with the help of WSDL file ?
 
crap..
@bwoebi ideas to fix?
 
10:47 AM
@bwoebi nooooooooooo
 
@AlmaDo when you have any better idea? :-P
 
static var may be?
 
PHP >= 5.3.7. :(
I am on 5.2.6
 
@AlmaDo not across functions
 
10:48 AM
@bwoebi no other way? My goal is to create self-defined, closed 'black box' - independent of context
so global is not an option :\
 
@Duikboot the problem is not only using a safe algorithm now, but be able to change it later to a new, currently unknown, safer one
 
@AlmaDo use closures and don't unregister it, then it works too ;-)
@AlmaDo but using both… no way I know…
 
@bwoebi bad idea since it will affect all other code too (very destructive and hard-to-debug side-effect)
urrr.. I'm so close
blasted bugs :\
 
@AlmaDo yeah, dmitry will fix this today or tomorrow.
 
@AlmaDo wll you could use a functor with __toString and define a function that unregisters the functor instance shudder
 
10:51 AM
will be in php 5.5.7 and php 5.4.23 then ;-)
 
DAmmit stupid old php version.
 
@ThomasWeinert impossible since Closure is final
 
@AlmaDo class Functor() { __invoke() {} __toString() }
 
@ThomasWeinert that won't work
 
is it possible to know the WSDL URL for a web service, with the help of just wsdl file being generated? I mean, if we have the WSDL file with us, can we determine the web service URL ?
 
10:53 AM
huh..
@ThomasWeinert didn't get that. How will that work?
 
@AlmaDo It won't work due to the internal implementation of (un)register_tick_function
 
I'm trying now
 

« first day (1125 days earlier)      last day (3828 days later) »