473,396 Members | 1,834 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,396 software developers and data experts.

Any possible reason why "$line.serialize($rs2)" refuses to execute?

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 any error, and
just gives a blank screen.

I narrowed down the problem to: $line.serialize($rs2)
Am I missing something maybe in the PHP5 configuration?

Jan 12 '06 #1
10 1726
Rafi B. wrote:
I narrowed down the problem to: $line.serialize($rs2)
Am I missing something maybe in the PHP5 configuration?


This is probably too obvious, but when $line is an object and serialize() a
method of this object, the call should be:

$line->serialize($rs2);
JW
Jan 13 '06 #2
This is the context in which it is executed:
$line = "====1,$tt,$sql\n";
$rs2->sql = $rs->sql;
$rs2->oldProvider = $rs->dataProvider;
$rs2->InitArrayFields($rows,$flds);
$rs2->fetchMode = $savefetch;
return $line.serialize($rs2);

$rs2 is a Recordset, this code is part of ADOdb caching function, which
tries to serialize a recordset from database, and saves it into a file.
When I do print_r($rs2) it seems that all the data is there, the last
line, even without the concating of $line, just crashes. Without any
message.

What I've been through the past days because of this is insane.
Upgraded cPanel, upgraded Apache, all my apps and modules are identical
to a friends' server which this code runs so smoothly on it makes me
want to cry.

Any help why serialize() will just crash like this?

Janwillem Borleffs wrote:
Rafi B. wrote:
I narrowed down the problem to: $line.serialize($rs2)
Am I missing something maybe in the PHP5 configuration?


This is probably too obvious, but when $line is an object and serialize() a
method of this object, the call should be:

$line->serialize($rs2);
JW


Jan 13 '06 #3
Rafi B. wrote:
This is the context in which it is executed:
$line = "====1,$tt,$sql\n";
$rs2->sql = $rs->sql;
$rs2->oldProvider = $rs->dataProvider;
$rs2->InitArrayFields($rows,$flds);
$rs2->fetchMode = $savefetch;
return $line.serialize($rs2);
[...] Any help why serialize() will just crash like this?


Well, for one thing, $line.serialize() isn't valid PHP syntax for a method
call, because of the dot. That it executes on your friend's system probably
has to do with his error_reporting and display_errors settings. Ask him if
queries ever get cached and the answer probably will be negative.

When the $rs2 object contains the serialize method, you probably should do
something like:

return $rs2->serialize();

When, however, you goal is to apply the native PHP serialize function, the
call probably should be:

return serialize($rs2);
JW
Jan 13 '06 #4

Janwillem Borleffs wrote:

Well, for one thing, $line.serialize() isn't valid PHP syntax for a method
call, because of the dot. That it executes on your friend's system probably
has to do with his error_reporting and display_errors settings. Ask him if
queries ever get cached and the answer probably will be negative.
It does. I coded his site, and the caching works like a charm.From a 8 second heavy queried home page, to 0.5 second serverside loadtime,
its cached every hour.

What the guys in the ADOdb code are doing is concating the $line with
the
result of serialize($rs2). So: return $line.serialize($rs2); IS valid
in PHP,
maybe more clear would be: return $line . serialize($rs2);
When the $rs2 object contains the serialize method, you probably should do
something like:


Their just serializing the $rs object. That's it. When I try to execute
the query
without caching, I receive a return into "$myresult" lets say for
example, this
will contain an array of all the fields that my query returned, and
when I do IN MY CODE:
$sdata = serialize($myresult);

CRASHES. Fatal. Doesn't spit anything in the logs, or screen. Just dies
so brutally.

I'm pulling out hairs here.

Jan 14 '06 #5
My title for this thread should be: Why serialize($rs) crashes
brutally?
I've narrowed it down to this. Why does it happen? On the same code,
same ADOdb library version, both on my Friend's Linux Server, and
another Windows Server, it SHOULD work according to ADOdb and hundreds
of their fans. And it works for me, but on servers other than mine.
Only I'm screwed. Dunno why.

PHP version 5.0.5 by the way.

Jan 14 '06 #6
Rafi B. wrote:
result of serialize($rs2). So: return $line.serialize($rs2); IS
valid in PHP,
maybe more clear would be: return $line . serialize($rs2);


Yep, you're right. My bad, I was sleeping.

Regarding the version you are using (5.0.5), which version is used on the
environments which do not have problems?

Perhaps it would be an idea to simply update your environment to the latest
stable release (5.1.2). What you also can do is set up a test to see at
which point the serialize() function crashes.

Just comment out portings of the class instantiated through the $rs2 object
and de-comment portions up untill the moment serialize() crashes.
JW
Jan 14 '06 #7
Problem is, I'm very new to Linux, and I have a Linux/CentOs/cPanel
server
and the cPanel support PHP until version 5.0.5

Janwillem Borleffs wrote:
Rafi B. wrote:
result of serialize($rs2). So: return $line.serialize($rs2); IS
valid in PHP,
maybe more clear would be: return $line . serialize($rs2);


Yep, you're right. My bad, I was sleeping.

Regarding the version you are using (5.0.5), which version is used on the
environments which do not have problems?

Perhaps it would be an idea to simply update your environment to the latest
stable release (5.1.2). What you also can do is set up a test to see at
which point the serialize() function crashes.

Just comment out portings of the class instantiated through the $rs2 object
and de-comment portions up untill the moment serialize() crashes.
JW


Jan 14 '06 #8
Rafi B. wrote:
Problem is, I'm very new to Linux, and I have a Linux/CentOs/cPanel
server
and the cPanel support PHP until version 5.0.5


Well, then try the debugging routine I suggested. It might give you a clue
on what's going on.
JW
Jan 15 '06 #9
Rafi B. wrote:
<snip>
when I do IN MY CODE:
$sdata = serialize($myresult);

CRASHES. Fatal. Doesn't spit anything in the logs, or screen. Just dies
so brutally.


What's in $myresult?
Do a var_dump($myresult)

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
Jan 15 '06 #10
FIXED !!!
It was apprently a PHP 5.0.5 overflow bug, or something like it.
Looking through the BUG FIXES of PHP 5.1.2 I saw some fixes for
serialize/deserialize, thanks for Dimitry and Ilia, the bug fixers, and
the fact that I've upgraded PHP to 5.1.2, everything works like a charm.

Jan 18 '06 #11

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

Similar topics

6
by: DFS | last post by:
One of my systems grew exponentially - from 13mb to 43mb - after adding some 10 temp tables (with no data), a new form, and about a thousand lines of code. The .mdb has mostly table links, lots of...
1
by: stjulian | last post by:
I have a stored procedure which returns 2 tables and 1 output value. I want the first table to be assigned to rs1 and the second to rs2. However when I run this, I get the following error as I...
60
by: sang | last post by:
Hello i have a doubt in string count with the sub string. the main string is "java,mysql,jsp,java,html"; the sub string is like this "java,mysql" The output is like this java 2...
30
by: fniles | last post by:
On my machine in the office I change the computer setting to English (UK) so the date format is dd/mm/yyyy instead of mm/dd/yyyy for US. This problem happens in either Access or SQL Server. In the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...

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.