Error _tostring() cannot take arguments in Mac with PHP 5.3

thread: 23 messages  |  last: about 6 months ago  |  started: friday, february 6, 2009, 3:52 am pst


#1  |  ipshop (Andalucia, Cordoba) Spain
Friday, February 6, 2009, 3:52 AM PST

i have installed qcodo on Leopard 10.5.6 using apache Version     Apache/2.2.11 and PHP 5.3

I was getting blank page, to find more info about error i have commentted out the ob setup in includes/qcodo/_core/qcodo.inc.php, around line 54:
//    ob_start('__ob_callback');

So know i can get a  more manageable error message.

The error is:
Fatal error: Method QDateTime::__tostring() cannot take arguments in /home/cables/www/qcodo/includes/qcodo/_core/framework/QDateTime.class.php on line 337

Please can you tell me how can i fix that?

THank you in advance.

#2  |  Basilieus (Tucson,AZ) United States of America
Thursday, February 12, 2009, 12:32 PM PST

try __toString

with a capital S

#3  |  ipshop (Andalucia, Cordoba) Spain
Thursday, February 12, 2009, 2:23 PM PST

THank you for your help

But all functions are declared and used like __toString
i dont know why error message appear with string in lowercase as __tostring

any other suggestion?

#4  |  Basilieus (Tucson,AZ) United States of America
Thursday, February 12, 2009, 2:40 PM PST

Did you check the actual function __toString in QDateTime.class?  Does it have parameters you can add?

I'm not to sure why this is happening, but can you post some of your code?

Thanks.

#5  |  ipshop (Andalucia, Cordoba) Spain
Thursday, February 12, 2009, 3:01 PM PST

The error is:
Fatal error: Method QDateTime::__tostring() cannot take arguments in /home/cables/www/qcodo/includes/qcodo/_core/framework/QDateTime.class.php on line 337

This is the function that report error:

220                  *  ttt - Timezone as a three-letter code (e.g. GMT)
221                  *
222                  * @param string $strFormat the format of the date
223                  * @return string the formatted date as a string
224                  */
225                 public function __toString($strFormat = null) {
226                         $this->ReinforceNullProperties();
227                         if (is_null($strFormat))
228                                 $strFormat = QDateTime::$DefaultFormat;
229
230                         /*
231                                 (?(?=D)([D]+)|
232                                         (?(?=M)([M]+)|
233                                                 (?(?=Y)([Y]+)|
234                                                         (?(?=h)([h]+)|
235                                                                 (?(?=m)([m]+)|
236                                                                         (?(?=s)([s]+)|
237                                                                                 (?(?=z)([z]+)|
238                                                                                         (?(?=t)([t]+)|
239                                 ))))))))
240                         */
241
242 //                      $strArray = preg_split('/([^D^M^Y^h^m^s^z^t])+/', $strFormat);
243                         preg_match_all('/(?(?=D)([D]+)|(?(?=M)([M]+)|(?(?=Y)([Y]+)|(?(?=h)([h]+)|(?(?=m)([m]+)|(?(?=s)([s]+)|(?(?=z)([z]+)|(?(?=t)([t]+)|))))))))/', $strFormat, $strArray);
244                         $strArray = $strArray[0];
245                         $strToReturn = '';
246
247                         $intStartPosition = 0;
248                         for ($intIndex = 0; $intIndex < count($strArray); $intIndex++) {
249                         $strToken = trim($strArray[$intIndex]);
250                                 if ($strToken) {
251                                         $intEndPosition = strpos($strFormat, $strArray[$intIndex], $intStartPosition);
252                                         $strToReturn .= substr($strFormat, $intStartPosition, $intEndPosition - $intStartPosition);
253                                         $intStartPosition = $intEndPosition + strlen($strArray[$intIndex]);
254
255                                         switch ($strArray[$intIndex]) {
256                                                 case 'M':
257                                                         $strToReturn .= parent::format('n');
258                                                         break;
259                                                 case 'MM':
260                                                         $strToReturn .= parent::format('m');
261                                                         break;
262                                                 case 'MMM':
263                                                         $strToReturn .= parent::format('M');
264                                                         break;
265                                                 case 'MMMM':
266                                                         $strToReturn .= parent::format('F');
267                                                         break;
268
269                                                 case 'D':
270                                                         $strToReturn .= parent::format('j');
271                                                         break;
272                                                 case 'DD':
273                                                         $strToReturn .= parent::format('d');
274                                                         break;
275                                                 case 'DDD':
276                                                         $strToReturn .= parent::format('D');
277                                                         break;
278                                                 case 'DDDD':
279                                                         $strToReturn .= parent::format('l');
280                                                         break;
281
282                                                 case 'YY':
283                                                         $strToReturn .= parent::format('y');
284                                                         break;
285                                                 case 'YYYY':
286                                                         $strToReturn .= parent::format('Y');
287                                                         break;
288
289                                                 case 'h':
290                                                         $strToReturn .= parent::format('g');
291                                                         break;
292                                                 case 'hh':
293                                                         $strToReturn .= parent::format('h');
294                                                         break;
295                                                 case 'hhh':
296                                                         $strToReturn .= parent::format('G');
297                                                         break;
298                                                 case 'hhhh':
299                                                         $strToReturn .= parent::format('H');
300                                                         break;
301
302                                                 case 'mm':
303                                                         $strToReturn .= parent::format('i');
304                                                         break;
305
306                                                 case 'ss':
307                                                         $strToReturn .= parent::format('s');
308                                                         break;
309
310                                                 case 'z':
311                                                         $strToReturn .= parent::format('a');
312                                                         break;
313                                                 case 'zz':
314                                                         $strToReturn .= parent::format('A');
315                                                         break;
316                                                 case 'zzz':
317                                                         $strToReturn .= sprintf('%s.m.', substr(parent::format('a'), 0, 1));
318                                                         break;
319                                                 case 'zzzz':
320                                                         $strToReturn .= sprintf('%s.M.', substr(parent::format('A'), 0, 1));
321                                                         break;
322
323                                                 case 'ttt':
324                                                         $strToReturn .= parent::format('T');
325                                                         break;
326
327                                                 default:
328                                                         $strToReturn .= $strArray[$intIndex];
329                                         }
330                                 }
331                         }
332
333                         if ($intStartPosition < strlen($strFormat))
334                                 $strToReturn .= substr($strFormat, $intStartPosition);
335
336                         return $strToReturn;
337                 }

#6  |  Basilieus (Tucson,AZ) United States of America
Thursday, February 12, 2009, 3:18 PM PST

Yes, I mean can you post the code where you are using the DateTime object?

Thanks

#7  |  ipshop (Andalucia, Cordoba) Spain
Thursday, February 12, 2009, 3:35 PM PST

I am trying to open the Qcodo Development Framework - Start Page

http://localhost/qcodo/

#8  |  Basilieus (Tucson,AZ) United States of America
Thursday, February 12, 2009, 5:47 PM PST

interesting, I'm not to sure...

Try out QCubed.. its just an extension of QCodo with all the bug fixes:

http://qcu.be

See if that does the samething, if so, than it sounds like a configuration problem.

#9  |  ipshop (Andalucia, Cordoba) Spain
Friday, February 13, 2009, 3:21 PM PST

same problem with qcube.

Configuration problem?
this is my config:
                       define ('__DOCROOT__', '/home/cables/www');
                       define ('__VIRTUAL_DIRECTORY__', '/qcubed');
                       define ('__SUBDIRECTORY__', '/qcodo');

tell me how can i find where is the problem please, i am very interested to use qcube or qcodo.

Thank you

#10  |  Basilieus (Tucson,AZ) United States of America
Friday, February 13, 2009, 9:25 PM PST

Interesting that it doesn't show you anything but a blank page.  

So using those defined variables that you posted you should have a directory structure like..

/home/cables/www/qcubed/qcodo/index.php

Try and make it look like this:

define ('__DOCROOT__', '/home/cables/www');
                       define ('__VIRTUAL_DIRECTORY__', '');
                       define ('__SUBDIRECTORY__', '');

And also make sure you copy the WWWROOT folder from Qcodo/Qcubed into /home/cables/www so that the index.php and index.tpl.php are in the folder like so:

/home/cables/www/index.php

Let me know if that works.



Copyright © 2005 - 2010, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.