473,413 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Serialize string contains line feed?

Consider the following program, how to make it work properly when a
string contains line-feed?

<?php

$temp = "this is a \ntest";

print serialize($temp);

?>


thanks.

Sep 22 '06 #1
3 2024
ho******@gmail.com said the following on 22/09/2006 19:27:
Consider the following program, how to make it work properly when a
string contains line-feed?

<?php

$temp = "this is a \ntest";

print serialize($temp);

?>
What do you mean by "work properly"?

--
Oli
Sep 22 '06 #2
hi,

pls ignore the above example,

use the following one:

$temp = array( "this is a \ntest\";1", "sdsdssd") ;

print_r ( ( serialize($temp) ); // error here

how to make the code `safe` for any input?

thanks

Oli Filth wrote:
ho******@gmail.com said the following on 22/09/2006 19:27:
Consider the following program, how to make it work properly when a
string contains line-feed?

<?php

$temp = "this is a \ntest";

print serialize($temp);

?>

What do you mean by "work properly"?

--
Oli
Sep 24 '06 #3
ho******@gmail.com said the following on 24/09/2006 16:52:
Oli Filth wrote:
>ho******@gmail.com said the following on 22/09/2006 19:27:
>>Consider the following program, how to make it work properly when a
string contains line-feed?

<?php

$temp = "this is a \ntest";

print serialize($temp);

?>
What do you mean by "work properly"?
pls ignore the above example,

use the following one:

$temp = array( "this is a \ntest\";1", "sdsdssd") ;

print_r ( ( serialize($temp) ); // error here

how to make the code `safe` for any input?
The error is due to the mismatched parentheses (you've opened 3, but
only closed 2).
P.S. It is customary to not top-post in this newsgroup. :)
--
Oli
Sep 24 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Michael | last post by:
Hi I anyone have a clue or can solve my problem I would be glad :-) Regards Michael I have a problem with creating an XML-document where the returning data from the webservice, have been...
14
by: vince | last post by:
Can I add (append) to an xml file that already contains a serialized object, and be able to deserialize to either or both objects from the same file...??? How is this done...?? thanks, vince
10
by: Dan | last post by:
All I Am Attempting To Serialize An Object To An XML File. Here Is The Code For That public string SaveNewSurvey( MutualSurveyObject mso_TempObject, int i_JobID ) { string s_RootFileName;...
10
by: Rafi B. | last post by:
I'm running this on a Linux/CentOs/cPanel server, trying to add caching to my PHP5 code, using ADOdb. I have two Linux servers, one of them is running perfect, the second one, just crashes without...
8
by: cd~ | last post by:
I can provide a test app, the news server won't allow me to post the files because they are too large (93KB and 1.2KB) I downloaded the ESRI ArcXml schema and generated the classes from the...
3
by: Mirek Endys | last post by:
What is the best way to serialize object, that contains data in interfaces. Simple. I have instance of my object, that contains data in interfaces. What is the best way to XMLSerialize and...
1
by: Rick Luckwell | last post by:
I have 3 collections(reports, services, charts) of objects(report, service, chart) that are nested with each other. When I serialize the object the output only contains reports and services but...
4
by: randy1200 | last post by:
Using Visual Studio 2005. I'm using XmlReader to read data into a string variable in C#. Works great! Every once in a while, I see that the string data contains a symbol that looks like a...
4
by: Hone | last post by:
I'm trying to serialize/deserialize the XML for an RSS 1.0 Feed (i.e. RDF) and the root element, as required by the standard, looks like this: <rdf:RDF ...> </rdf:RDF> However, I've tried...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.