Skip to content
This repository

PHP 5.4.6 + Propel 1.6.8 #614

Closed
zeuben opened this Issue · 15 comments

5 participants

Alessandro Di Candia Markus Staab Marc J. Schmidt Ciro Mattia Gonano Jérémie Augustin
Alessandro Di Candia

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
                )

        )
Markus Staab
Collaborator

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

Alessandro Di Candia

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.

Marc J. Schmidt
Owner

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

Alessandro Di Candia
Marc J. Schmidt
Owner

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

Marc J. Schmidt
Owner

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 :yellow_heart:

Markus Staab
Collaborator

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

Alessandro Di Candia
Markus Staab
Collaborator

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

Ciro Mattia Gonano

@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

Alessandro Di Candia
Jérémie Augustin
Collaborator

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

Alessandro Di Candia
Ciro Mattia Gonano

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.

Alessandro Di Candia

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

Alessandro Di Candia zeuben closed this
Toni Uebernickel havvg referenced this issue from a commit in Ormigo/Propel
Toni Uebernickel havvg Merge branch 'master' into ormigo
* master:
  add one-to-one handling to VersionableBehavior
  Update .travis.yml
  Revert bad CS fix (alternative CS behavior)
  Prepare 1.6.9 release
  Fix CS
  Fixes JOIN duplication issue when default join type equals given join type (issue #373)
  Bugfix for join equality when default join type is used
  {Sluggable] fix issue with slug ending with 0XYZ
  [Sluggable] add test to prove issue with slug ending with 0XYZ
  add test for issue #622
  Correctly add map namespace when $phpName has no backslash (e.g. namespaces are not used) - fixes #614

Conflicts:
	generator/lib/behavior/versionable/VersionableBehaviorObjectBuilderModifier.php
460d68f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.