Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DooSqlMagic m:n "limit" #85

Open
GoogleCodeExporter opened this issue Jan 8, 2016 · 0 comments
Open

DooSqlMagic m:n "limit" #85

GoogleCodeExporter opened this issue Jan 8, 2016 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1.  m:n relation
2. staticaly call relation with _first  or "limit"=>1 option  


What is the expected output? What do you see instead?
dooframework/db/DooSqlMagic.php(1462) calling array_splice()


array_splice() expects parameter 2 to be long, string given



What version of the product are you using? On what operating system?

Path: doophp-read-only/dooframework/db/DooSqlMagic.php
Name: DooSqlMagic.php
URL: http://doophp.googlecode.com/svn/trunk/dooframework/db/DooSqlMagic.php
Repository Root: http://doophp.googlecode.com/svn
Repository UUID: eaaf3d48-7251-11de-8585-3f51e31374b7
Revision: 717
Node Kind: file
Schedule: normal
Last Changed Author: richard.myers@hotmail.co.uk
Last Changed Rev: 711
Last Changed Date: 2012-04-22 17:44:29 +0200 (Ne, 22 dub 2012)
Text Last Updated: 2012-11-15 19:11:30 +0100 (Čt, 15 lis 2012)
Checksum: 4d84ff3bc7cc81842b089a74e5df24fb

Please provide any additional information below.


I found two problems with condition  on row 1418


   if($opt['limit']==1 || $opt['limit']=='first'){
                            $opt['limit'] = 'first';
                            $limitstr = 1;
                        }else{
                            $limitstr = $opt['limit'];
                        }

first: 
$opt['limit'] = 'first'; is forced to set to 'first' when you  limiting query 
to 1
but its used late as offset for array_splice.
                            $limitLength = explode(',', $opt['limit']);
                            if(isset($limitLength[1])){
                                array_splice($limitModelStr, $limitLength[1]);
                            }else{
                                array_splice($limitModelStr, $limitLength[0]);
                            }

second issue:
when you use limit range like "1,2", its converted to integer, so you get  same 
issue.







Original issue reported on code.google.com by Hoca.Nas...@gmail.com on 17 Nov 2012 at 1:35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant