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

0.7 RC1 fetchList() with null WHERE throws an exception #24

Open
GoogleCodeExporter opened this issue Oct 13, 2015 · 9 comments
Open

0.7 RC1 fetchList() with null WHERE throws an exception #24

GoogleCodeExporter opened this issue Oct 13, 2015 · 9 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. $document = new App_Model_Mapper_Document();
2. $document->fetchList(null, 'DocumentTypeID'); //only ORDER BY
3. Exception thrown in models/DbTable/TableAbstract.php:146
App_Model_DbTable_TableAbstract->fetchList(Array, 'DocumentTypeID', NULL, NULL) 
with message: "You must pass integer indexes on the select statement array."

What is the expected output? What do you see instead?
Select runs with only an ORDER BY fetching all rows.

What version of the product are you using? On what operating system?
0.7 RC 1 (this is a regression)

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 18 Jun 2012 at 10:10

@GoogleCodeExporter
Copy link
Author

Try using array() instead of null, that should work

Original comment by pedrospdc on 26 Jun 2012 at 2:48

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Original comment by pedrospdc on 26 Jun 2012 at 2:49

@GoogleCodeExporter
Copy link
Author

If I remember well, that doesn't work either because of the "&& 
isset($where[0])" condition.

And as I can see without trying it, the function countByQuery() (right up 
there) also suffers from the empty/default $where bug.

Original comment by [email protected] on 26 Jun 2012 at 3:02

@GoogleCodeExporter
Copy link
Author

Indeed, those come from the changes I've made on 0.7. I'll work on the fix asap.

Thanks!

Original comment by pedrospdc on 26 Jun 2012 at 3:03

@GoogleCodeExporter
Copy link
Author

TableAbstract.php, return early if $where is empty

public function fetchList($where = null, $order = null, $count = null, $offset 
= null)
    {
        $select = $this->select()
                    ->order($order)
                    ->limit($count, $offset);

        if (empty($where))
            return $select;

        if (! empty($where) && is_string($where))

Original comment by [email protected] on 3 Sep 2012 at 3:05

@GoogleCodeExporter
Copy link
Author

Hello,

Is there a patch available for this?

Original comment by [email protected] on 21 Sep 2012 at 5:50

@GoogleCodeExporter
Copy link
Author

Hello Aaron,
Due to some "madness", "apocalypse" or even "bad things" happening at my work 
place I've been really really busy for the past months. 
You can use diegotdai's suggestion - just manually edit 
classes/TableAbstract.php function and generate the models again, then replace 
your old TableAbstract.php model at your project models folder. (No need to 
replace every model)

I'll work on an patch until then

Original comment by pedrospdc on 21 Sep 2012 at 7:00

@GoogleCodeExporter
Copy link
Author

Precise is a leading brand for Model makers and engineering model makers. With 
our innovative ideas, excellent artisans and specialized materials.

Original comment by [email protected] on 8 Nov 2012 at 6:37

@GoogleCodeExporter
Copy link
Author

or put 1=1 in where

Original comment by [email protected] on 26 Nov 2012 at 2:07

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