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

PHP 5.4.6 + Propel 1.6.8 #614

Closed
zeuben opened this issue Feb 19, 2013 · 15 comments
Closed

PHP 5.4.6 + Propel 1.6.8 #614

zeuben opened this issue Feb 19, 2013 · 15 comments

Comments

@zeuben
Copy link

zeuben commented Feb 19, 2013

line 171 of DatabaseMap.php

is improperly handling $phpName

here is backtrace:

Array
(
    [0] => Array
        (
            [function] => raindrop_autoload
            [args] => Array
                (
                    [0] => map\avedSearchTableMap
                )

        )

    [1] => Array
        (
            [function] => spl_autoload_call
            [args] => Array
                (
                    [0] => map\avedSearchTableMap
                )

        )

    [2] => Array
        (
            [file] => /www/orm/vendor/propel/propel1/runtime/lib/map/DatabaseMap.php
            [line] => 171
            [function] => class_exists
            [args] => Array
                (
                    [0] => \map\avedSearchTableMap
                )

        )

    [3] => Array
        (
            [file] => /www/orm/vendor/propel/propel1/runtime/lib/query/ModelCriteria.php
            [line] => 70
            [function] => getTableByPhpName
            [class] => DatabaseMap
            [object] => DatabaseMap Object
                (
                    [name:protected] => raindrop
                    [tables:protected] => Array
                        (
                        )

                    [tablesByPhpName:protected] => Array
                        (
                        )

                )

            [type] => ->
            [args] => Array
                (
                    [0] => SavedSearch
                )

        )
@staabm
Copy link
Member

staabm commented Feb 19, 2013

Whats the problem? Any error message? How to reproduce?

@zeuben
Copy link
Author

zeuben commented Feb 19, 2013

issue occurs during autoloading.
i'm using the composer version of propel 1.6.8.

here's what's going on:

'SavedSearchQuery' is being called statically.
Propel is trying to find it and some how coming back with 'map\avedSearchTableMap' as the class name to load.

if i change line 171 of DatabaseMap.php from:

} elseif (class_exists($tmClass = substr_replace($phpName, '\\map\\', strrpos($phpName, '\\'), 1) . 'TableMap')) 

to:

} elseif (class_exists($tmClass = substr_replace($phpName, '\\map\\', strrpos($phpName, '\\'), 0) . 'TableMap')) 

and then in my autoloader...

function my_autoload($class_name){

    //i also have to add this for my app to run.
    $class_name = str_replace("map\\",'',$class_name);

    if (propel::autoload($class_name) === false) {
        //look in application classmap ...
    }

}

it works.

@marcj
Copy link
Member

marcj commented Feb 19, 2013

@zeuben, nice you caught the bug. Can you make a pull-request?

@zeuben
Copy link
Author

zeuben commented Feb 19, 2013

is it a bug?
my fix seems more like a hack than something you want to pull in..
never made a PR before, what is expected?

On Tue, Feb 19, 2013 at 5:06 PM, MArc J. Schmidt
notifications@git.luolix.topwrote:

@zeuben https://github.com/zeuben, nice you caught the bug. Can you
make a pull-request?


Reply to this email directly or view it on GitHubhttps://github.com//issues/614#issuecomment-13802888.

@marcj
Copy link
Member

marcj commented Feb 19, 2013

It looks to me like an error as it generates from SavedSearch the classname \map\avedSearchTableMap which is definitely wrong.

@marcj
Copy link
Member

marcj commented Feb 19, 2013

well, please don't pull you hack/workaround, but better fix the line 171 of DatabaseMap.php and run the test suite (as explained here http://propelorm.org/cookbook/working-with-unit-tests.html). :-) If you're able to add additionally a unit-test for this case then that would be for sure a great PR 💛

@staabm
Copy link
Member

staabm commented Feb 20, 2013

@zeuben are you able and willing to provide a unit test and fix for your issue?

@zeuben
Copy link
Author

zeuben commented Feb 20, 2013

am willing, currently not able -- but it is on my to do's.
looking forward to contributing as soon as i can.

On Wed, Feb 20, 2013 at 4:40 PM, Markus Staab notifications@git.luolix.topwrote:

@zeuben https://github.com/zeuben are you able and willing to provide a
unit test and fix for your issue?


Reply to this email directly or view it on GitHubhttps://github.com//issues/614#issuecomment-13858322.

@staabm
Copy link
Member

staabm commented Feb 20, 2013

Great. if you need any support, feel free to ask...

@ciromattia
Copy link
Contributor

@staabm seems the same I commented on #385, I thought it was a class_exist() problem but I definitely have the same problem here: my AppProfile class is searched as map\ppProfile

@zeuben
Copy link
Author

zeuben commented Feb 27, 2013

If anyone can help on the PR, I can help test. Super jammed up right now.
On Feb 26, 2013 6:58 PM, "Ciro Mattia Gonano" notifications@github.com
wrote:

@staabm https://github.com/staabm seems the same I commented on #385#385,
I thought it was a class_exist() problem but I definitely have the same
problem here: my AppProfile class is searched as map\ppProfile


Reply to this email directly or view it on GitHubhttps://github.com//issues/614#issuecomment-14147855
.

@jaugustin
Copy link
Member

@zeuben could test with last master branch and tell us if your issue is fixed ?

@zeuben
Copy link
Author

zeuben commented Mar 11, 2013

does not seem to have fixed my issue.
still seeing the botched paths.
here is the call stack:

Array
(
[0] => Array
(
[function] => my_autoload
[args] => Array
(
[0] => map\avedSearchTableMap
)

    )

[1] => Array
    (
        [function] => spl_autoload_call
        [args] => Array
            (
                [0] => map\avedSearchTableMap
            )

    )

[2] => Array
    (
        [file] =>

/www/orm/vendor/propel/propel1/runtime/lib/map/DatabaseMap.php
[line] => 171
[function] => class_exists
[args] => Array
(
[0] => \map\avedSearchTableMap
)

    )

[3] => Array
    (
        [file] =>

/www/orm/vendor/propel/propel1/runtime/lib/query/ModelCriteria.php
[line] => 70
[function] => getTableByPhpName
[class] => DatabaseMap
[object] => DatabaseMap Object
(
[name:protected] => raindrop
[tables:protected] => Array
(
)

                [tablesByPhpName:protected] => Array
                    (
                    )

            )

        [type] => ->
        [args] => Array
            (
                [0] => SavedSearch
            )

    )

On Mon, Mar 11, 2013 at 5:09 AM, Jérémie Augustin
notifications@git.luolix.topwrote:

@zeuben https://github.com/zeuben could test with last master branch
and tell us if your issue is fixed ?


Reply to this email directly or view it on GitHubhttps://github.com//issues/614#issuecomment-14702853
.

@ciromattia
Copy link
Contributor

As far as I can see you're still using Packagist's distribution, which is master-based, and the PR is still to be merged.
To test it you should checkout @jaugustin branch with PR #629 and check against that code.

@zeuben
Copy link
Author

zeuben commented Apr 1, 2013

everything seems to work with the @jaugustin branch. ROCK!

@zeuben zeuben closed this as completed Apr 1, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants