[PHP] Copy sent mail in a mailbox folder
Hi list, I'm sending mails with PEAR::Mail / PEAR::Mail_Mime or with PHPMailer (http://phpmailer.sf.net). The final solution will implemented depending on which implementation better fits my needs. Anyway, and that is the problem, after sending the mail I want to save a copy of the mail in an IMAP folder called "Sent". I would be pleased if someone could send me a hint or a link how to achive this. Either with PEAR or with PHPMailer generated mails. My first thought was to walk through the mail object and extracting all necessary attributes and generating a new message and save this to the mailfolder... Thanks in advance reto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy sent mail in a mailbox folder PS
Hi again, Anyway, and that is the problem, after sending the mail I want to save a copy of the mail in an IMAP folder called "Sent". Just found the imap_append() which will solve the problem. If someone has experience with mail_append() in conjunction with PEAR Mail_Mime I would be please if sharing with me... cu reto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Missing images
Hi all I have kind of a very strange problem... But I hope someone can help. Imageing a little web-based application for browsing images. Every page is exactly the same (from a php point of view). A user can browse through all the images which are displayed as thumbnails. Normally, everything works fine... But on some browsers (and or operating systems), suddenly, at a certain point, all images are turning white. No more new images are shown. Old images (which have already been shown earlier) are fine, but no new ones. They are just white. Reloading the page or reentering the URL doesn't work. The only thing which does work is shutting down the browser and restarting the whole thing. So, why do some images turn white? These normally happens after about the 6th page of images (12 iamges a page). Any idea? Thanks a lot reto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Header Location not working
Hi all Does somebody know if there is a potential problem with Header("Location: "); not working properly? I have a redirection, but it seems that on some browser, this doesn't work. Instead of the redirection, the same page is requested again! I'm also using sessions and html-post request to get to this page (probably they are messing things up). On most browser, the setup is working very well... Thanks for the help reto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header Location not working
It's mainly MSIE 5.0 for MacOS or MSIE 5.5 for Win9x "Bigdog" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > What browsers are having the problems? > > On Tue, 2002-11-19 at 15:36, Baumann Reto wrote: > > Hi all > > > > Does somebody know if there is a potential problem with > > Header("Location: "); > > not working properly? > > > > I have a redirection, but it seems that on some browser, this doesn't work. > > Instead of the redirection, the same page is requested again! > > > > I'm also using sessions and html-post request to get to this page (probably > > they are messing things up). > > On most browser, the setup is working very well... > > > > Thanks for the help > > reto > > > -- > .: B i g D o g :. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header Location not working
This does work... No problem at all... The BIG problem is that it has to have something to do with the environment, as the error is not always there. Only if a certain combination of POST/GET request and or browsers as well as session operations occur. Bur figuring out a certain logic is nearly impossible. reto "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > --- Baumann Reto <[EMAIL PROTECTED]> wrote: > > Does somebody know if there is a potential problem with > > Header("Location: "); > > not working properly? > > Try this code: > > header("Location: http://www.google.com/";); > ?> > > If this does not work, let us know. > > Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header Location not working
Yes, I have an exit() immediately following header... Could these statements in any way affect the session? Or session update? "Jason Wong" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Wednesday 20 November 2002 06:36, Baumann Reto wrote: > > Hi all > > > > Does somebody know if there is a potential problem with > > Header("Location: "); > > not working properly? > > > > I have a redirection, but it seems that on some browser, this doesn't work. > > Instead of the redirection, the same page is requested again! > > Do you have exit() after using header()? You should. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > U X > e dUdX, e dX, cosine, secant, tangent, sine, 3.14159... > */ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting an RGB value of a pixel (JPEG)
Hi there I have to get an RGB value of a specified pixel in an JPEG image. This image uses 24bit per pixel (so is true-color). How could this be done? Thanks a lot Reto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Load Balancing and PHP Sessions
Is it possible to have sessions (via cookie) on a load balanced environment? Therefore having www1.test.com and www2.test.com and share the same sessions? The systems can access the same file-system, but it seems that the session is not passed. Could this have something to do with session.cookie_domain? Thanks for any help Reto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Lossless JPEG image rotation
Is there a good way to rotate a JPEG image (90°, 180° or 270°)? I tried jpegtran and convert (ImageMagick)... But they both don't really work as expected. Why? jpegtran only workes if used with -trim. But this trims the image (cuts some pixels away), which is not a very good way. ImageMagick's convert isn't lossless :( Any other ideas? Thanks a lot Reto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Reading class variable value always returns NULL
Hi, So I have this strange situation where I assign a classvariable a value, but when I read the value it is NULL. The class has one variable declared: = class A { private $_cookies; } = In a method of this class I assign this classvariable plus an undeclared classvariable and a local variable the value 1: = $this->_cookies = 1; $this->_cookies2 = 1; $cookies3 = 1; = When I now read the values of those variables, the classvariables are NULL while the local variable is 1: = $logEntry .= 'cookies: ' . var_export($this->_cookies, true) . PHP_EOL; $logEntry .= 'cookies2: ' . var_export($this->_cookies2, true) . PHP_EOL; $logEntry .= 'cookies3: ' . var_export($cookies3, true) . PHP_EOL; = cookies: NULL cookies2: NULL cookies3: 1 = But when reading the whole object, the classvariables are 1: = $logEntry .= var_export($this, true) . PHP_EOL; = A::__set_state(array( '_cookies' => 1, '_cookies2' => 1, )) = This happens periodically on a busy webserver. It seems that when it happens, all classvariables cannot be read anymore (return NULL). After restarting Apache it does not happen anymore, just to happen again after some minutes. The system is current Debian Squeeze: Linux: linux-image-2.6.32-5-amd64 Apache: apache2-mpm-prefork 2.2.16-6+squeeze7 PHP: PHP 5.3.3-7+squeeze13 with Suhosin-Patch (cli) (built: Jun 10 2012 07:31:32) php -m: https://raw.github.com/gist/3331641/2f7e80bd03abfb728b659634d3f4bac0131f4d6a/gistfile1.txt php -i: https://raw.github.com/gist/3331651/bcf6e3654bf391482627505447848de173d0bbab/gistfile1.txt Does anyone have an idea what could cause this, or how to further debug? Thanks, Reto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading class variable value always returns NULL
Hi, Thanks for your input Robert and Volmar! I have googled again with "instance variable" instead of "class variable" - but have not found any similar reports. I'm pretty sure those are the same objects. The application usually runs alright. We only see the instance variables becoming NULL since about a week. We had 3 small software upgrade coming from debian since we observe the problem. We think they cannot be related. Still we have reverted all of those and still see the problem. Next step is that we setup a exact copy of the machine. Maybe it is a hardware problem... Thanks, Reto On Mon, Aug 13, 2012 at 5:09 PM, Robert Cummings wrote: > On 12-08-12 08:32 AM, Reto Kaiser wrote: >> >> Hi, >> >> So I have this strange situation where I assign a classvariable a >> value, but when I read the value it is NULL. >> >> The class has one variable declared: >> = >> class A { >> private $_cookies; >> } >> = > > > That is a private instance variable NOT a class variable. > > To declare a class variable you would do the following: > > > class A > { > private static $_cookies; > } > > ?> > > >> In a method of this class I assign this classvariable plus an >> undeclared classvariable and a local variable the value 1: >> = >> $this->_cookies = 1; >> $this->_cookies2 = 1; >> $cookies3 = 1; >> = >> >> When I now read the values of those variables, the classvariables are >> NULL while the local variable is 1: >> = >> $logEntry .= 'cookies: ' . var_export($this->_cookies, true) . PHP_EOL; >> $logEntry .= 'cookies2: ' . var_export($this->_cookies2, true) . PHP_EOL; >> $logEntry .= 'cookies3: ' . var_export($cookies3, true) . PHP_EOL; >> = >> cookies: NULL >> cookies2: NULL >> cookies3: 1 >> = >> >> But when reading the whole object, the classvariables are 1: >> = >> $logEntry .= var_export($this, true) . PHP_EOL; >> = >> A::__set_state(array( >> '_cookies' => 1, >> '_cookies2' => 1, >> )) >> = >> >> >> This happens periodically on a busy webserver. It seems that when it >> happens, all classvariables cannot be read anymore (return NULL). >> After restarting Apache it does not happen anymore, just to happen >> again after some minutes. >> >> The system is current Debian Squeeze: >> Linux: linux-image-2.6.32-5-amd64 >> Apache: apache2-mpm-prefork 2.2.16-6+squeeze7 >> PHP: PHP 5.3.3-7+squeeze13 with Suhosin-Patch (cli) (built: Jun 10 >> 2012 07:31:32) >> php -m: >> https://raw.github.com/gist/3331641/2f7e80bd03abfb728b659634d3f4bac0131f4d6a/gistfile1.txt >> php -i: >> https://raw.github.com/gist/3331651/bcf6e3654bf391482627505447848de173d0bbab/gistfile1.txt >> >> Does anyone have an idea what could cause this, or how to further debug? > > > I can't really speak to your specific problem (unless you're using two > different instances of the class), just thought I'd clear up the difference > between class variables and instance variables. > > Cheers, > Rob. > -- > E-Mail Disclaimer: Information contained in this message and any > attached documents is considered confidential and legally protected. > This message is intended solely for the addressee(s). Disclosure, > copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading class variable value always returns NULL
Hi, We have since deployed another webserver machine and observe the exact same behavior there. So it is not a hardware problem. We have also disabled various php modules, but this didn't help either. Any debug suggestions are welcome! :) Reto On Tue, Aug 14, 2012 at 10:40 AM, Reto Kaiser wrote: > Hi, > > Thanks for your input Robert and Volmar! I have googled again with > "instance variable" instead of "class variable" - but have not found > any similar reports. > > I'm pretty sure those are the same objects. The application usually > runs alright. We only see the instance variables becoming NULL since > about a week. > > We had 3 small software upgrade coming from debian since we observe > the problem. We think they cannot be related. Still we have reverted > all of those and still see the problem. > Next step is that we setup a exact copy of the machine. Maybe it is a > hardware problem... > > Thanks, > Reto > > On Mon, Aug 13, 2012 at 5:09 PM, Robert Cummings wrote: >> On 12-08-12 08:32 AM, Reto Kaiser wrote: >>> >>> Hi, >>> >>> So I have this strange situation where I assign a classvariable a >>> value, but when I read the value it is NULL. >>> >>> The class has one variable declared: >>> = >>> class A { >>> private $_cookies; >>> } >>> = >> >> >> That is a private instance variable NOT a class variable. >> >> To declare a class variable you would do the following: >> >> > >> class A >> { >> private static $_cookies; >> } >> >> ?> >> >> >>> In a method of this class I assign this classvariable plus an >>> undeclared classvariable and a local variable the value 1: >>> = >>> $this->_cookies = 1; >>> $this->_cookies2 = 1; >>> $cookies3 = 1; >>> = >>> >>> When I now read the values of those variables, the classvariables are >>> NULL while the local variable is 1: >>> = >>> $logEntry .= 'cookies: ' . var_export($this->_cookies, true) . PHP_EOL; >>> $logEntry .= 'cookies2: ' . var_export($this->_cookies2, true) . PHP_EOL; >>> $logEntry .= 'cookies3: ' . var_export($cookies3, true) . PHP_EOL; >>> = >>> cookies: NULL >>> cookies2: NULL >>> cookies3: 1 >>> = >>> >>> But when reading the whole object, the classvariables are 1: >>> = >>> $logEntry .= var_export($this, true) . PHP_EOL; >>> = >>> A::__set_state(array( >>> '_cookies' => 1, >>> '_cookies2' => 1, >>> )) >>> = >>> >>> >>> This happens periodically on a busy webserver. It seems that when it >>> happens, all classvariables cannot be read anymore (return NULL). >>> After restarting Apache it does not happen anymore, just to happen >>> again after some minutes. >>> >>> The system is current Debian Squeeze: >>> Linux: linux-image-2.6.32-5-amd64 >>> Apache: apache2-mpm-prefork 2.2.16-6+squeeze7 >>> PHP: PHP 5.3.3-7+squeeze13 with Suhosin-Patch (cli) (built: Jun 10 >>> 2012 07:31:32) >>> php -m: >>> https://raw.github.com/gist/3331641/2f7e80bd03abfb728b659634d3f4bac0131f4d6a/gistfile1.txt >>> php -i: >>> https://raw.github.com/gist/3331651/bcf6e3654bf391482627505447848de173d0bbab/gistfile1.txt >>> >>> Does anyone have an idea what could cause this, or how to further debug? >> >> >> I can't really speak to your specific problem (unless you're using two >> different instances of the class), just thought I'd clear up the difference >> between class variables and instance variables. >> >> Cheers, >> Rob. >> -- >> E-Mail Disclaimer: Information contained in this message and any >> attached documents is considered confidential and legally protected. >> This message is intended solely for the addressee(s). Disclosure, >> copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading class variable value always returns NULL
Hey, We have: error_reporting((E_ALL | E_STRICT) & ~(E_NOTICE | E_USER_NOTICE)); Displaying errors is disabled: display_errors = Off We have a custom error handler which logs all errors to a file. In this file we receive byeffect errors, like that the second argument to "array_key_exists" should be array, but is NULL. When we further debug the reason is that the second argument is an instance variable, and all instance variables are NULL. We're pretty sure this is a software bug, since it only happens from time to time, and already happens in the first line of the php script, when none of our application code was loaded. For example: foo = 1; if ($a->foo === null) { throw new Exception("strange"); } will throw an exception. Since it only happens from time to time, it is really hard to debug. We're now trying to reproduce in a virtual machine environment, while replaying the actual requests that our webserver received. When we're just simulating random load on the web server it doesn't happen. So it must have something to do with certain requests, and they must have some strange byeffect on php, or mod_php or something related. Any input welcome! Thanks, Reto On Tue, Aug 14, 2012 at 11:11 PM, Jim Lucas wrote: > On 08/12/2012 05:32 AM, Reto Kaiser wrote: >> >> Hi, >> >> So I have this strange situation where I assign a classvariable a >> value, but when I read the value it is NULL. >> >> Does anyone have an idea what could cause this, or how to further debug? >> >> Thanks, >> Reto >> > > What is your error reporting set to? > > Do you have display errors turned on? > > Are you saving your errors to a log file? > > -- > Jim Lucas > > http://www.cmsws.com/ > http://www.cmsws.com/examples/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading class variable value always returns NULL
So here's some new observations on the instance variables being NULL. As far as we found out this is the sequence of events: 1. Apache (MPM) received request A which executes a php script. 2. Within this script during the unserialization of an object an exception is thrown. 3. This exception is catched and an error message is display to standard output with "echo". 4. The script ends normally and the standard output contents are returned in the HTTP response. 5. From now on this Apache worker is "tainted", meaning that every subsequent request will result in: 6. The same apache worker receives request B which executes a PHP script. 7. Within this PHP script reading instance variables will always return NULL, e.g.: foo = 1; // Now: $a->foo === NULL All subsequent requests to this apache worker will behave like this. The constellation leading to this behavior is very hard to further simplify. If we throw different exceptions, or unserialize different objects it doesn't happen anymore... As a workaround we added "exit;" to the end of our php script. With a call to "exit" the apache worker will not get "tainted"... Regards, Reto On Tue, Aug 14, 2012 at 11:52 PM, Reto Kaiser wrote: > Hey, > > We have: > error_reporting((E_ALL | E_STRICT) & ~(E_NOTICE | E_USER_NOTICE)); > > Displaying errors is disabled: > display_errors = Off > > We have a custom error handler which logs all errors to a file. > In this file we receive byeffect errors, like that the second argument > to "array_key_exists" should be array, but is NULL. When we further > debug the reason is that the second argument is an instance variable, > and all instance variables are NULL. > We're pretty sure this is a software bug, since it only happens from > time to time, and already happens in the first line of the php script, > when none of our application code was loaded. > For example: > > class A{} > $a = new A(); > $a->foo = 1; > if ($a->foo === null) { > throw new Exception("strange"); > } > > will throw an exception. > > Since it only happens from time to time, it is really hard to debug. > We're now trying to reproduce in a virtual machine environment, while > replaying the actual requests that our webserver received. When we're > just simulating random load on the web server it doesn't happen. So it > must have something to do with certain requests, and they must have > some strange byeffect on php, or mod_php or something related. > > Any input welcome! > > Thanks, > Reto > > On Tue, Aug 14, 2012 at 11:11 PM, Jim Lucas wrote: >> On 08/12/2012 05:32 AM, Reto Kaiser wrote: >>> >>> Hi, >>> >>> So I have this strange situation where I assign a classvariable a >>> value, but when I read the value it is NULL. >>> >>> Does anyone have an idea what could cause this, or how to further debug? >>> >>> Thanks, >>> Reto >>> >> >> What is your error reporting set to? >> >> Do you have display errors turned on? >> >> Are you saving your errors to a log file? >> >> -- >> Jim Lucas >> >> http://www.cmsws.com/ >> http://www.cmsws.com/examples/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sorting Objects in an array by object properties
Hello list, I have an array which holds some objects. Each object represent elements from an email header in a given mailbox. Each object has properties like "from", "sendtime", "subject" etc. I want to sort the order of the objects in the array by their attribute "sendtime" in order to get a list of email header sorted by their arrival time. Has anyone an idea how to solve this? I tried various of the array sorting functions but without success. Thanks in advance Reto PS: The array has the following structure: Array ( [0] => mail_Header Object ( [id] => 1 [pid] => 1 [read] => r [flagged] => n [from] => [EMAIL PROTECTED] [subject] => Re: [ugffm] TYPO3 anybody ? [sendtime] => 2005.05.17 - 18:27:25 ) [1] => mail_Header Object ( [id] => 2 [pid] => 1 [read] => r [flagged] => n [from] => [EMAIL PROTECTED] [subject] => Re: [ugffm] website [sendtime] => 2005.05.17 - 19:13:26 ) ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php