Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7611307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:38:19+00:00 2026-05-31T01:38:19+00:00

The question probably sounds quite odd, and indeed it is. Here’s the problem: I

  • 0

The question probably sounds quite odd, and indeed it is. Here’s the problem: I have a model, FollowingStationLine, and its corresponding table, following_station_lines. In the model, I am trying to save a record with $this->save(array('field' => 'value));. When I hit the corresponding page, the method seems to be calling in an infinite loop (I’ve put some debug()s before and after the save statement) and it ends only when the memory limit has been reached. I tried even with 2GB of memory, and still the same issue.

This happens also when calling the method from another controller, other than FollowingStationLinesController. All other models/tables work as expected, beside this one. I really can’t imagine what is the problem. Here are the codes for the controller, respectively the model:

Controller:

    App::uses('AppController', 'Controller');

    class FollowingStationLinesController extends AppController {

    public function admin_set() {
        $this->FollowingStationLine->set(array(1));
    }

}

Model:

App::uses('AppModel', 'Model');

class FollowingStationLine extends AppModel {
    public function set($lineIds = array()){
        if(!is_array($lineIds)){
            return false;   
        }
        $save = array();
        $save[] = array('station_id' => 45);
        debug($save[0]);
        $this->save($save[0]);
    }
  }

Any help would be highly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:38:21+00:00Added an answer on May 31, 2026 at 1:38 am

    CakePHP’s AppModel class has a function called ‘set’ that is called by the model’s ‘save’ function. By overrriding ‘set’, you are causing a loop between the 2 methods.

    Rename your function to something else and you should be ok.

    You can inspect the AppModel source for more info: https://github.com/cakephp/cakephp/blob/master/lib/Cake/Model/Model.php


    UPDATE:

    @mark made a very good comment that if your PHP configuration included error reporting mode E_STRICT, you would have received an error for overriding with a mismatched signature.

    More info to set your configuration: http://php.net/manual/en/migrating5.errorrep.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The question probably sounds a little odd, but the actual task is relatively simple,
This probably sounds like a really dumb question, but here goes....Web Services, what the
I know it probably sounds like very trivial question but I couldn't find any
Ok, so this question probably isn't Silverlight specific. I have a silverlight 2 page
This is confusing me, so this question will probably be confusing. I have a
This probably sounds like a silly question to seasoned Rails developer. Do I need
This probably sounds like a stupid question, but I'm going to give it a
This is probably a really obvious question, but it's driving me nuts. We have
Yes, this sounds like a simple question, and it probably is. But when i
I'm aware that there probably isn't a perfect solution to my question (this sounds

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.