This repository has been archived by the owner. It is now read-only.

JDatabaseQuery clones $db Object #1167

Closed
HLeithner opened this Issue Apr 22, 2012 · 2 comments

Comments

Projects
None yet
3 participants

Testing:
$query = JFactory::getDbo()->getQuery(true);
$clonedquery = clone $query;
$quotedstring = $clonedquery->q('string');

Ends in:
Warning: mysqli_real_escape_string(): Couldn't fetch mysqli in libraries/joomla/database/database/mysqli.php on line 157

I think cloning the $db Object in JDatabaseQuery is a bad Idea, so adding a exception for the database variable would be a solution.

Contributor

elinw commented May 12, 2012

https://github.com/joomla/joomla-platform/blob/staging/tests/suites/unit/joomla/database/JDatabaseQueryTest.php

Could you outline or propose a failing test that illustrates this problem?

http://php.net/manual/en/mysqli.real-escape-string.php

I think the problem is probably not the clone, it's probably the handling of mysqli_escape_string versus mysql_escape_string (which are different see above kubj) but this requires some digging.

P.S. obviously you are using 11.4 not the current platform but this part of he code has not changed although it has been moved around.
I think part of the problem is the error suppression here
https://github.com/joomla/joomla-cms/blob/master/libraries/joomla/database/database/mysqli.php#L98
which is creating a red herring.

Contributor

elinw commented Jul 14, 2012

See also closed issue #238.
Which session handler are you using?

@dongilbert dongilbert closed this Mar 16, 2013

@elinw elinw referenced this issue in joomla/joomla-framework Apr 22, 2013

Closed

Don't try to close a connection that does not exist. #137

eddieajau added a commit to joomla/joomla-framework that referenced this issue Apr 23, 2013

dongilbert added a commit to joomla-framework/database that referenced this issue May 13, 2013

dongilbert added a commit to joomla-framework/database that referenced this issue Jun 4, 2013

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.