#789 √ resolved
tomws

cake/libs/model/cake_schema.php clobbers table in 'cake schema generate' output

Reported by tomws | June 3rd, 2010 @ 05:20 PM | in 1.3.1

Commit af6435ece8ced3a83ba9 (to cake/libs/model/cake_schema.php) breaks the results of 'cake schema generate' (and 'dump') in some circumstances. In my case, it "forgets" the acos table in the output schema.php. I have not been able to contrive an example outside of my app, however.

If I'm not mistaken, line 266 in the read() function was overlooked during the round of variable name changes from that commit.

$key = array_search($table, $currentTables);

should be

$key = array_search($withTable, $currentTables);

Otherwise, since the $table key of $currentTables has been previously unset (see line 256), $key here is assigned false and this results in $currentTables[0] being unset on line 270. In my case, that happened to be the acos table which was completely unrelated but sitting in position zero in the $currentTables array.

As stated, I can't create an example, but I'd be happy to code dump on someone if you need something to test. The change above, however, fixed the problem here.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Source available from github

Repository is at http://github.com/cakephp/cakephp

Creating a bug report

When creating a bug report, please include as much relevant information as possible. Please include code to reproduce the issue. Or even better, make a unit test. Either change an existing test or add a new test to show that the expected behavior is not occuring.

People watching this ticket

Referenced by