Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

newsletter error when reopening old newsletter (DataObject::get_by_id passed a non-numeric ID #$id")


Go to End
Reply


10 Posts   3533 Views

Avatar
grandsapin1673

Community Member, 12 Posts

3 November 2009 at 6:46am

Hello,
I just upgraded to SS 2.3.3
Newsletter : newsletter-trunk-r88195
userforms : userforms-v0.2.0
I have the following problem :
When browsing in admin to the sent newsletter / Most recent / my news and clicking on it., I get "error loading page" in red at bottom.

in debug mode, using Firebug, I see the error as pasted below. ->DataObject::get_by_id passed a non-numeric ID #$id"

Does it sounds like something known?

Many thanks,

Eric Chappuis

POST http://www.sclausanne.ch/admin/newsletter/shownewsletter/3
POST http://www.sclausanne.ch/admin/newsletter/shownewsletter/3
   
500 Warning: "DataObject::get_by_id passed a non-numeric ID #" at line 2566 of /home/www/660365d5f22429ae7b9568b2935920be/web/sapphire/core/model/DataObject.php
      308ms   prototyp...257148694 (ligne 765)
ParamètresEn-têtesPostPutRéponseCacheHTML
Réponse
Date   Mon, 02 Nov 2009 17:30:11 GMT
Server   Apache
Expires   Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control   no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma   no-cache
Set-Cookie   PastMember=1; expires=Sun, 31-Jan-2010 17:30:11 GMT; path=/
Content-Length   1529
Connection   close
Content-Type   text/plain
Requête
Host   www.sclausanne.ch
User-Agent   Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 GTB5 (.NET CLR 3.5.30729)
Accept   text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language   fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding   gzip,deflate
Accept-Charset   ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive   300
Connection   keep-alive
X-Requested-With   XMLHttpRequest
X-Prototype-Version   1.4.0_rc3
Content-Type   application/x-www-form-urlencoded; charset=utf-8
Referer   http://www.sclausanne.ch/admin/newsletter/
Content-Length   16
Cookie   PastVisitor=1; PastMember=1; PHPSESSID=5124bb9057a6e4d3094fcab228de1508; alc_enc=1%3Afe43bcb5e13e47fe08779901dfedb968
ajax   1
otherid   3

ERROR [Warning]: DataObject::get_by_id passed a non-numeric ID #
IN POST /admin/newsletter/shownewsletter/3
Line 2566 in /home/www/660365d5f22429ae7b9568b2935920be/web/sapphire/core/model/DataObject.php

Source
======
2557:            $tableClasses = ClassInfo::dataClassesFor($callerClass);
2558:            $baseClass = array_shift($tableClasses);
2559:            return DataObject::get_one($callerClass,"`$baseClass`.`ID` = $id");
2560:
2561:            // This simpler code will be used by non-DataObject classes that implement DataObjectInterface
2562:         } else {
2563:            return DataObject::get_one($callerClass,"`ID` = $id");
2564:         }
2565:      } else {
* 2566:         user_error("DataObject::get_by_id passed a non-numeric ID #$id", E_USER_WARNING);
2567:      }
2568:   }
2569:
2570:   /**
2571:    * Get the name of the base table for this object
2572:    */

<ul>user_error(DataObject::get_by_id passed a non-numeric ID #,512)
line 2566 of DataObject.php

DataObject::get_by_id(Newsletter,)
line 511 of NewsletterAdmin.php

NewsletterAdmin->getNewsletterEditForm()
line 141 of NewsletterAdmin.php

NewsletterAdmin->shownewsletter(SSHTTPRequest)
line 162 of Controller.php

Controller->handleAction(SSHTTPRequest)
line 129 of RequestHandler.php

RequestHandler->handleRequest(SSHTTPRequest)
line 122 of Controller.php

Controller->handleRequest(SSHTTPRequest)
line 277 of Director.php

Director::handleRequest(SSHTTPRequest,Session)
line 121 of Director.php

Director::direct(/admin/newsletter/shownewsletter/3)
line 118 of main.php

</ul>

500//ERROR [Warning]: DataObject::get_by_id passed a non-numeric ID # IN POST /admin/newsletter/shownewsletter/3 Line 2566 in /home/www/660365d5f22429ae7b9568b2935920be/web/sapphire/core/model/DataObject.php Source ====== 2557: $tableClasses = ClassInfo::dataClassesFor($callerClass); 2558: $baseClass = array_shift($tableClasses); 2559: return DataObject::get_one($callerClass,"`$baseClass`.`ID` = $id"); 2560: 2561: // This simpler code will be used by non-DataObject classes that implement DataObjectInterface 2562: } else { 2563: return DataObject::get_one($callerClass,"`ID` = $id"); 2564: } 2565: } else { * 2566: user_error("DataObject::get_by_id passed a non-numeric ID #$id", E_USER_WARNING); 2567: } 2568: } 2569: 2570: /** 2571: * Get the name of the base table for this object 2572: */ <ul>user_error(DataObject::get_by_id passed a non-numeric ID #,512) line 2566 of DataObject.php DataObject::get_by_id(Newsletter,) line 511 of NewsletterAdmin.php NewsletterAdmin->getNewsletterEditForm() line 141 of NewsletterAdmin.php NewsletterAdmin->shownewsletter(SSHTTPRequest) line 162 of Controller.php Controller->handleAction(SSHTTPRequest) line 129 of RequestHandler.php RequestHandler->handleRequest(SSHTTPRequest) line 122 of Controller.php Controller->handleRequest(SSHTTPRequest) line 277 of Director.php Director::handleRequest(SSHTTPRequest,Session) line 121 of Director.php Director::direct(/admin/newsletter/shownewsletter/3) line 118 of main.php </ul>
_firebugEvalEvent()

Avatar
grandsapin1673

Community Member, 12 Posts

11 November 2009 at 10:45am

Still get this problem.. anybody could help?
Thanks,
Eric

Avatar
grandsapin1673

Community Member, 12 Posts

11 November 2009 at 11:03am

same happens if reopening draft.... arghhh.

Avatar
grandsapin1673

Community Member, 12 Posts

10 December 2009 at 11:39am

got it !

This is the known problem about HTTPRequest being defined in the PHP environment out of the core SS class

In NewsletterAdmin.php row 138, rename the HTTPRequest class accordingly to the new name gievn in the core framework

Hope it helps.

Avatar
Anonymous user

Community Member, 1 Post

12 March 2010 at 3:55am

I'm having this same problem, what was the correct class name you ended up using in NewsletterAdmin.php?

Avatar
dendeffe

Community Member, 135 Posts

12 October 2010 at 7:24am

SS_HTTPRequest

I also found I need to replace Database to SS_Database as I’m working through trying to revive the Newsletter module :)

Avatar
swaiba

Forum Moderator, 1805 Posts

13 October 2010 at 7:48am

Hi dendeffe, are you planning on sharing your the new healthy code you are imparting on the newsletter module? which versions are you working with?

I may have the wrong view but I have found it a little unreliable with 2.4 - so much so I haven't used it much - although it is of course greatly appreciated.

Avatar
dendeffe

Community Member, 135 Posts

13 October 2010 at 9:11am

I've got it more or less working at the moment. At the moment, I'm working on sending through a SMTP server instead of with mail(), though.

Tommorow morning, I'll see if I can upload a version that is working here. I started with the trunk version from svn.silverstripe.com

Go to Top