Author Topic: PHP warning  (Read 8084 times)

cc08

  • Newbie
  • *
  • Posts: 27
    • View Profile
PHP warning
« on: August 31, 2016, 01:43:46 AM »
Hi, people!

Not so long I see in logs next string:
Code: [Select]
PHP Warning:  fputs() expects parameter 1 to be resource, null given in /usr/local/share/yate/scripts/libyate.php on line 64
In this case all of the php scripts are working properly, I think.

Is it dangerous ?
What is the cause of this message?

My php:
Code: [Select]
php -v
PHP 5.6.24-0+deb8u1 (cli) (built: Jul 26 2016 08:17:07)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

My yate:
Code: [Select]
YATE 5.5.1-devel1 r6083 (http://YATE.null.ro) ready on sip.server.
Thanks.

Monica Tepelus

  • Administrator
  • Full Member
  • *****
  • Posts: 198
    • View Profile
Re: PHP warning
« Reply #1 on: August 31, 2016, 06:50:08 AM »
Hi,

It's not dangerous, but you might lose some debug messages and it might be confusing.

It seems you are using Yate::Output("message") in the scripts without running Yate::Output(true) before the main loop.  In this case the debug messages won't appear in Yate telnet log, and they will be pushed to the php error stream.

By following the code it seems the error stream could not pe opened for write: fopen("php://stderr","w").

It would be better to put Yate::Output(true) before using  Yate::Output("message") in the scripts. It might be confusing not seeing the messages when debugging

cc08

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: PHP warning
« Reply #2 on: September 02, 2016, 05:57:53 AM »
Thanks Monica!

I understood.
I have found an error in my script and fix it.