Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fatal error: "Nesting level too deep [ .. ] recursive dependency [ .. ]" #579

Open
havvg opened this Issue · 1 comment

1 participant

@havvg

When saving object, using the DebugPDO, it happens to break on the var_export within DebugPDOStatement::bindValue raising a fatal error "Nesting level too deep ..." (max nesting level is set to 150).

I tried to fix this by applying the following patch.

diff --git a/runtime/lib/connection/DebugPDOStatement.php b/runtime/lib/connection/DebugPDOStatement.php
index 3f0ca37..fa1f6b0 100644
--- a/runtime/lib/connection/DebugPDOStatement.php
+++ b/runtime/lib/connection/DebugPDOStatement.php
@@ -112,7 +112,24 @@ class DebugPDOStatement extends PDOStatement
         $debug    = $this->pdo->getDebugSnapshot();
         $typestr  = isset(self::$typeMap[$type]) ? self::$typeMap[$type] : '(default)';
         $return   = parent::bindValue($pos, $value, $type);
-        $valuestr = $type == PDO::PARAM_LOB ? '[LOB value]' : var_export($value, true);
+
+        switch ($type) {
+            case PDO::PARAM_LOB:
+                $valuestr = '[LOB value]';
+                break;
+
+            case PDO::PARAM_BOOL:
+                $valuestr = $value ? 'true': 'false';
+                break;
+
+            case PDO::PARAM_STR:
+                $valuestr = sprintf("'%s'", $value);
+                break;
+
+            default:
+                $valuestr = print_r($value, true);
+        }
+
         $msg      = sprintf('Binding %s at position %s w/ PDO type %s', $valuestr, $pos, $typestr);

         $this->boundValues[$pos] = $valuestr;

However, the testsuite fails at this point (and further errors of same type).

1) ModelCriteriaTest::testFindByArray
findByArray() adds multiple column conditions
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'SELECT book.id, book.title, book.isbn, book.price, book.publisher_id, book.author_id FROM `book` WHERE book.title='Don Juan' AND book.isbn=12345'
+'SELECT book.id, book.title, book.isbn, book.price, book.publisher_id, book.author_id FROM `book` WHERE book.title='Don Juan' AND book.isbn='12345''

According to the schema it's a string, so I would assume, the patched version is the correct one.

<column name="isbn" required="true" type="VARCHAR" size="24" phpName="ISBN" description="ISBN Number" primaryString="false" />

After changing those failures, I got this one:

1) SubQueryTest::testSubQueryCount
addSelectQuery() doCount is defined as complexQuery
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'SELECT COUNT(*) FROM (SELECT subCriteriaAlias.id, subCriteriaAlias.title, subCriteriaAlias.isbn, subCriteriaAlias.price, subCriteriaAlias.publisher_id, subCriteriaAlias.author_id FROM (SELECT book.id, book.title, book.isbn, book.price, book.publisher_id, book.author_id FROM `book`) AS subCriteriaAlias WHERE subCriteriaAlias.price<20) propelmatch4cnt'
+'SELECT COUNT(*) FROM (SELECT subCriteriaAlias.id, subCriteriaAlias.title, subCriteriaAlias.isbn, subCriteriaAlias.price, subCriteriaAlias.publisher_id, subCriteriaAlias.author_id FROM (SELECT book.id, book.title, book.isbn, book.price, book.publisher_id, book.author_id FROM `book`) AS subCriteriaAlias WHERE subCriteriaAlias.price<'20') propelmatch4cnt'

This happens, as the float is passed in with PDO::PARAM_STR, so I changed the patch to this one: case (PDO::PARAM_STR && is_string($value)): instead of the param type check only. Then again the ISBN fails (falling back to current checked in version), but the float is correct.

I got no further idea, how to actually solve this to have the correct values in both cases, anyone can help?

@havvg

That's the error message, I received in the first place:

[2013-01-25 10:27:31] request.CRITICAL: PropelException: Unable to execute UPDATE statement [UPDATE `merchant_rating` SET `user_id`=:p1, `state`=:p2, `version`=:p3, `version_created_by`=:p4, `version_comment`=:p5 WHERE merchant_rating.id=:p6] [wrapped: Warning: var_export does not handle circular references in /srv/www/www/vendor/propel/propel1/runtime/lib/connection/DebugPDOStatement.php line 115] (uncaught exception) at /srv/www/www/vendor/propel/propel1/runtime/lib/util/BasePeer.php line 445 [] []

A simple Rating::save() causes it.

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.