473,661 Members | 2,449 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

$parts = $struct->parts;

Turning on error_reporting (E_ALL); was quite an eye opener as to
how much "fixing" PHP will do for the sloppy coder.

I fixed all of the errors except:
Notice: Undefined property: parts in
/ContactManageme nt/contact_mainpag e.php on line 120

where the line in question is:
$parts = $struct->parts;

where $struct = = imap_fetchstruc ture($in, $mid);

$struct is an object, parts is an array of objects

what would the correct syntax of the statement be ?

bill
Jun 14 '07 #1
8 2488
If you var_dump($struc t) right before that line, what do you see? It's
probably false or otherwise invalid. Maybe because it wasn't defined
or the imap function had a problem.

On Jun 13, 9:19 pm, bill <nob...@spamcop .netwrote:
Turning on error_reporting (E_ALL); was quite an eye opener as to
how much "fixing" PHP will do for the sloppy coder.

I fixed all of the errors except:
Notice: Undefined property: parts in
/ContactManageme nt/contact_mainpag e.php on line 120

where the line in question is:
$parts = $struct->parts;

where $struct = = imap_fetchstruc ture($in, $mid);

$struct is an object, parts is an array of objects

what would the correct syntax of the statement be ?

bill

Jun 14 '07 #2
>
On Jun 13, 9:19 pm, bill <nob...@spamcop .netwrote:
>Turning on error_reporting (E_ALL); was quite an eye opener as to
how much "fixing" PHP will do for the sloppy coder.

I fixed all of the errors except:
Notice: Undefined property: parts in
/ContactManageme nt/contact_mainpag e.php on line 120

where the line in question is:
$parts = $struct->parts;

where $struct = = imap_fetchstruc ture($in, $mid);

$struct is an object, parts is an array of objects

what would the correct syntax of the statement be ?

bill

petersprc wrote:
If you var_dump($struc t) right before that line, what do you
see? It's
probably false or otherwise invalid. Maybe because it wasn't
defined
or the imap function had a problem.
here is the dump
object(stdClass )(12) { ["type"]= int(0) ["encoding"]= int(0)
["ifsubtype"]= int(1) ["subtype"]= string(5) "PLAIN"
["ifdescript ion"]= int(0) ["ifid"]= int(0) ["lines"]=>
int(2) ["bytes"]= int(27) ["ifdisposit ion"]= int(0)
["ifdparamet ers"]= int(0) ["ifparamete rs"]= int(1)
["parameters "]= array(2) { [0]= object(stdClass )(2) {
["attribute"]= string(7) "CHARSET" ["value"]= string(10)
"ISO-8859-1" } [1]= object(stdClass )(2) { ["attribute"]=>
string(6) "FORMAT" ["value"]= string(6) "flowed" } } }
Jun 14 '07 #3
On 14 Jun, 11:14, bill <nob...@spamcop .netwrote:
On Jun 13, 9:19 pm, bill <nob...@spamcop .netwrote:
Turning on error_reporting (E_ALL); was quite an eye opener as to
how much "fixing" PHP will do for the sloppy coder.
I fixed all of the errors except:
Notice: Undefined property: parts in
/ContactManageme nt/contact_mainpag e.php on line 120
where the line in question is:
$parts = $struct->parts;
where $struct = = imap_fetchstruc ture($in, $mid);
$struct is an object, parts is an array of objects
what would the correct syntax of the statement be ?
bill

petersprc wrote:
If you var_dump($struc t) right before that line, what do you
see? It's
probably false or otherwise invalid. Maybe because it wasn't
defined
or the imap function had a problem.

here is the dump
object(stdClass )(12) { ["type"]= int(0) ["encoding"]= int(0)
["ifsubtype"]= int(1) ["subtype"]= string(5) "PLAIN"
["ifdescript ion"]= int(0) ["ifid"]= int(0) ["lines"]=>
int(2) ["bytes"]= int(27) ["ifdisposit ion"]= int(0)
["ifdparamet ers"]= int(0) ["ifparamete rs"]= int(1)
["parameters "]= array(2) { [0]= object(stdClass )(2) {
["attribute"]= string(7) "CHARSET" ["value"]= string(10)
"ISO-8859-1" } [1]= object(stdClass )(2) { ["attribute"]=>
string(6) "FORMAT" ["value"]= string(6) "flowed" } } }- Hide quoted text -

- Show quoted text -
So there you have the answer, parts is not listed.

Jun 14 '07 #4
On Wed, 13 Jun 2007 21:19:05 -0400, in comp.lang.php bill
<no****@spamcop .net>
<JO************ *************** ***@cablespeedm i.comwrote:
>| Turning on error_reporting (E_ALL); was quite an eye opener as to
| how much "fixing" PHP will do for the sloppy coder.
|
| I fixed all of the errors except:
| Notice: Undefined property: parts in
| /ContactManageme nt/contact_mainpag e.php on line 120
|
| where the line in question is:
| $parts = $struct->parts;
|
| where $struct = = imap_fetchstruc ture($in, $mid);
^^^^^
Is that a typo or actual code. If code it might be the source of the
problem.
>| $struct is an object, parts is an array of objects
|
| what would the correct syntax of the statement be ?
|
| bill
---------------------------------------------------------------
jn******@yourpa ntsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Jun 14 '07 #5
Captain Paralytic wrote:
On 14 Jun, 11:14, bill <nob...@spamcop .netwrote:
>>On Jun 13, 9:19 pm, bill <nob...@spamcop .netwrote:
Turning on error_reporting (E_ALL); was quite an eye opener as to
how much "fixing" PHP will do for the sloppy coder.
I fixed all of the errors except:
Notice: Undefined property: parts in
/ContactManageme nt/contact_mainpag e.php on line 120
where the line in question is:
$parts = $struct->parts;
where $struct = = imap_fetchstruc ture($in, $mid);
$struct is an object, parts is an array of objects
what would the correct syntax of the statement be ?
bill
petersprc wrote:
> If you var_dump($struc t) right before that line, what do you
see? It's
> probably false or otherwise invalid. Maybe because it wasn't
defined
> or the imap function had a problem.

here is the dump
object(stdClas s)(12) { ["type"]= int(0) ["encoding"]= int(0)
["ifsubtype"]= int(1) ["subtype"]= string(5) "PLAIN"
["ifdescript ion"]= int(0) ["ifid"]= int(0) ["lines"]=>
int(2) ["bytes"]= int(27) ["ifdisposit ion"]= int(0)
["ifdparamet ers"]= int(0) ["ifparamete rs"]= int(1)
["parameters "]= array(2) { [0]= object(stdClass )(2) {
["attribute"]= string(7) "CHARSET" ["value"]= string(10)
"ISO-8859-1" } [1]= object(stdClass )(2) { ["attribute"]=>
string(6) "FORMAT" ["value"]= string(6) "flowed" } } }- Hide quoted text -

- Show quoted text -

So there you have the answer, parts is not listed.
Well, that was simple.
in a 1 part message, parts is empty.
Ok, I will ignore that error because in the next line I check to
see if $parts is empty

Can anyone suggest a way of writing this so that the Notice error
would not pop up when parts does not exist - or is it worth it to
write super clean code ?

Here is the code segment:
$struct = imap_fetchstruc ture($in, $mid);
$parts = $struct->parts;
$i = 0;
if (!$parts) { /* Simple message, only 1 piece */
$attachment = array(); /* No attachments */
$content = imap_body($in,$ mid );
}
else { /* Complicated message, multiple parts */
stuff-------
}

bill
Jun 15 '07 #6
Jeff North wrote:
On Wed, 13 Jun 2007 21:19:05 -0400, in comp.lang.php bill
<no****@spamcop .net>
<JO************ *************** ***@cablespeedm i.comwrote:
>| Turning on error_reporting (E_ALL); was quite an eye opener as to
| how much "fixing" PHP will do for the sloppy coder.
|
| I fixed all of the errors except:
| Notice: Undefined property: parts in
| /ContactManageme nt/contact_mainpag e.php on line 120
|
| where the line in question is:
| $parts = $struct->parts;
|
| where $struct = = imap_fetchstruc ture($in, $mid);
^^^^^
Is that a typo or actual code. If code it might be the source of the
problem.
>| $struct is an object, parts is an array of objects
|
| what would the correct syntax of the statement be ?
|
| bill
---------------------------------------------------------------
jn******@yourpa ntsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
typo
Jun 15 '07 #7
bill wrote:
Captain Paralytic wrote:
>On 14 Jun, 11:14, bill <nob...@spamcop .netwrote:
>>>On Jun 13, 9:19 pm, bill <nob...@spamcop .netwrote:
Turning on error_reporting (E_ALL); was quite an eye opener as to
how much "fixing" PHP will do for the sloppy coder.
I fixed all of the errors except:
Notice: Undefined property: parts in
/ContactManageme nt/contact_mainpag e.php on line 120
where the line in question is:
$parts = $struct->parts;
where $struct = = imap_fetchstruc ture($in, $mid);
$struct is an object, parts is an array of objects
what would the correct syntax of the statement be ?
bill
petersprc wrote:

If you var_dump($struc t) right before that line, what do you
see? It's
probably false or otherwise invalid. Maybe because it wasn't
defined
or the imap function had a problem.

here is the dump
object(stdCla ss)(12) { ["type"]= int(0) ["encoding"]= int(0)
["ifsubtype"]= int(1) ["subtype"]= string(5) "PLAIN"
["ifdescript ion"]= int(0) ["ifid"]= int(0) ["lines"]=>
int(2) ["bytes"]= int(27) ["ifdisposit ion"]= int(0)
["ifdparamet ers"]= int(0) ["ifparamete rs"]= int(1)
["parameters "]= array(2) { [0]= object(stdClass )(2) {
["attribute"]= string(7) "CHARSET" ["value"]= string(10)
"ISO-8859-1" } [1]= object(stdClass )(2) { ["attribute"]=>
string(6) "FORMAT" ["value"]= string(6) "flowed" } } }- Hide quoted
text -

- Show quoted text -

So there you have the answer, parts is not listed.
Well, that was simple.
in a 1 part message, parts is empty.
Ok, I will ignore that error because in the next line I check to see if
$parts is empty

Can anyone suggest a way of writing this so that the Notice error would
not pop up when parts does not exist - or is it worth it to write super
clean code ?

Here is the code segment:
$struct = imap_fetchstruc ture($in, $mid);
$parts = $struct->parts;
$i = 0;
if (!$parts) { /* Simple message, only 1 piece */
$attachment = array(); /* No attachments */
$content = imap_body($in,$ mid );
}
else { /* Complicated message, multiple parts */
stuff-------
}

bill
if (isset($struct->parts)) { ...

And yes, it is worth it to write clean code.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 15 '07 #8
Jerry Stuckle wrote:
bill wrote:
>Captain Paralytic wrote:
>>On 14 Jun, 11:14, bill <nob...@spamcop .netwrote:
On Jun 13, 9:19 pm, bill <nob...@spamcop .netwrote:
>Turning on error_reporting (E_ALL); was quite an eye opener as to
>how much "fixing" PHP will do for the sloppy coder.
>I fixed all of the errors except:
>Notice: Undefined property: parts in
>/ContactManageme nt/contact_mainpag e.php on line 120
>where the line in question is:
>$parts = $struct->parts;
>where $struct = = imap_fetchstruc ture($in, $mid);
>$struct is an object, parts is an array of objects
>what would the correct syntax of the statement be ?
>bill
petersprc wrote:

If you var_dump($struc t) right before that line, what do you
see? It's
probably false or otherwise invalid. Maybe because it wasn't
defined
or the imap function had a problem.

here is the dump
object(stdCl ass)(12) { ["type"]= int(0) ["encoding"]= int(0)
["ifsubtype"]= int(1) ["subtype"]= string(5) "PLAIN"
["ifdescript ion"]= int(0) ["ifid"]= int(0) ["lines"]=>
int(2) ["bytes"]= int(27) ["ifdisposit ion"]= int(0)
["ifdparamet ers"]= int(0) ["ifparamete rs"]= int(1)
["parameters "]= array(2) { [0]= object(stdClass )(2) {
["attribute"]= string(7) "CHARSET" ["value"]= string(10)
"ISO-8859-1" } [1]= object(stdClass )(2) { ["attribute"]=>
string(6) "FORMAT" ["value"]= string(6) "flowed" } } }- Hide
quoted text -

- Show quoted text -

So there you have the answer, parts is not listed.
Well, that was simple.
in a 1 part message, parts is empty.
Ok, I will ignore that error because in the next line I check to see
if $parts is empty

Can anyone suggest a way of writing this so that the Notice error
would not pop up when parts does not exist - or is it worth it to
write super clean code ?

Here is the code segment:
$struct = imap_fetchstruc ture($in, $mid);
$parts = $struct->parts;
$i = 0;
if (!$parts) { /* Simple message, only 1 piece */
$attachment = array(); /* No attachments */
$content = imap_body($in,$ mid );
}
else { /* Complicated message, multiple parts */
stuff-------
}

bill

if (isset($struct->parts)) { ...

And yes, it is worth it to write clean code.
Thank you

bill
Jun 16 '07 #9

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

Similar topics

2
8452
by: KP | last post by:
I want to automatically highlight parts of a webpage (make them standout from the rest of the contents). These parts could be as small as single image tags, and as large as complex tables, parts of tables etc. What is guaranteed, however, is that the part to be highlighted will always be a complete block. Ideally I would like to is insert a single html tag around this block so that the contents of the block will standout on the page. I...
5
5321
by: Amil Hanish | last post by:
I have a huge byte array from another API that contains structs of differing sizes. I'd like to create n structs based on data in the byte array. But how? For example, if I want to take bytes 40-56 and create struct Foo from them...how do I do this? You can assume I know how to create the properly aligned struct. Thanks Amil
5
2417
by: Michael Herman \(Parallelspace\) | last post by:
1. What are some compelling solutions for using Master/Content pages with Web Pages? 2. If a content area has a web part zone with web parts, what is the user experience like when "editting" the web part page? Does it take place at the page level? ...or the content area level? 3. Where is the Web Part Manager instantiated? ...in the Master Page? ....Content Page? ...elsewhere?
2
3256
by: Juuso Hukkanen | last post by:
I need a list of multithreading unsafe C (C99) functions/features. comp.programming.threads provided an initial list of C:ish functions, with following ANSI C functions: asctime, gmtime, localtime, ctime, tmpnam, strtok http://www.lambdacs.com/cpt/FAQ.html#Q150 However, extra Googling hinted rand() and srand(), also being unsuitable for multi-threading - opinions? And what is the status of
3
1548
by: Rick | last post by:
I have a customer order form with a subform that lists parts per customer order that I'm updating. I'm trying to filer the parts list per Manufacture and Model number so that the user doesn't have to scroll through the complete list of parts to find the parts that relate to the model in question. I've got two combo boxes on the main form where you can select the manufacture, that filters the model combo box to show only models from that...
14
2553
by: embeddedc | last post by:
Hi, Referring to C90, is there somewhere published a list of all parts of the standard where the behavior is not specified or implementation dependent? If not and I want to find all such parts I could search a pdf version of the standard for keywords such as "implementation dependent" to highlight the section. Can anybody suggest a complete list of such keywords to make sure I find all the relevant sections?
18
1486
by: =?Utf-8?B?Q2hhcmxlc0E=?= | last post by:
I've just finished getting my web 2.0 MCTS, and the exam seemed to have a disproportionate interest in Web Parts. Personally, I don't really see the point of them Should I think again? can anyone show me a Site where Web parts are used in a way that makes them quite compelling as opposed to just a gimmick? also, I'm happy to hear any views on Web Parts both pro and con and with or
1
2334
by: horizon | last post by:
I was trying to test some code written in c using the HighPart & LowPart of the ULARGE_INTEGER struct and was slightly disappointed it's not implemented in c# only the QuadPart field is used. Does anyone know anything equivalent or how to implement all three parts in c# ? Thanks for any help.
58
8064
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also the parts section an i seem to be having trouble. When i try to insert into the parts section i get the error Invalid character value for cast specification. But not sure what i am doing wrong. Here is what i am using to insert. All the sections...
1
6029
by: Patricia Mindanao | last post by:
Assume I have a big picture on a web page. Now I want to logically (!) split this picture into multiple parts/areas. When I click e.g. on a the shape of building1 then the user should be redirected to web page "building1.html". When he clicks on the shape of person1 the user should be redirected to web page "man1.html" .... How can achieve this picture-multi-click feature? Pat
0
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8758
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7364
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5653
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4346
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1986
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.