Los Angeles, California (CNN) -- A judge on Friday ordered actress Lindsay Lohan to remain in a drug rehabilitation program until January 3 for a probation violation.
Lohan acknowledged in a series of Twitter messages in September that she failed the test and has a drug problem.
"Substance abuse is a disease, which unfortunately doesn't go away over night," Lohan wrote. "I am working hard to overcome it and am taking positive steps."
Los Angeles Superior Court Judge Elden Fox sent Lohan to jail four weeks ago, but another judge overturned the decision to deny the actress bail later that day.
Lohan, freed on $300,000 bail after 14 hours in jail, voluntarily checked into the Betty Ford Center in Rancho Mirage, California, three days later.
Defense lawyer Shawn Chapman Holley told CNN late Thursday that an online report that Lohan had left rehab was "totally untrue."
The Beverly Hills courthouse has been the scene of several Lohan appearances over the past year related to violations of her probation for a 2007 drunken driving conviction.
In July, Judge Marsha Revel ordered the actress to serve 90 days in jail and 90 days in rehab for violating her probation.
The sheriff released her from jail after just 13 days because of overcrowding, and her rehab stint at Ronald Reagan UCLA Medical Center ended after 23 days.
"She has learned her lesson," Holley told Fox as the judge agreed to let her out of rehab early on August 25.
Fox allowed Lohan to live in her West Hollywood, California, home as long as she followed a new set of rules, including regular drug testing. If she was successful for just 67 days, her supervised probation would end, he said.
"She's very serious about her sobriety," Holley said. "She looks forward to proving to the court that she is taking this seriously."
However, Lohan failed a drug test less than a month later, triggering Friday's probation violation hearing.
Lohan's legal troubles began when she was arrested twice in 2007 on charges of driving under the influence, and in the second incident, she was charged with cocaine possession.
The first arrest came after Lohan lost control of her Mercedes-Benz convertible and struck a curb in Beverly Hills, California.
Just two weeks after checking out of a Malibu, California, drug and alcohol rehabilitation facility, she was arrested again in July 2007 after a woman called Santa Monica, California, police, saying Lohan was trying to run her down with a car.
Lohan's acting career, which started at age 10 on a soap opera, took off on the big screen a year later, when she played identical twins in Disney's remake of "The Parent Trap."