php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59383 php_set_error_handling is deprecated in php-5.3
Submitted: 2010-08-23 16:57 UTC Modified: 2013-10-23 16:04 UTC
From: dave dot mulford at gmail dot com Assigned: tony2001 (profile)
Status: Closed Package: haru (PECL)
PHP Version: 5.3.2 OS: Gentoo Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dave dot mulford at gmail dot com
New email:
PHP Version: OS:

 

 [2010-08-23 16:57 UTC] dave dot mulford at gmail dot com
Description:
------------
haru-1.0.0 on php-5.3.3 (not selectable in the version drop-down above), gives the compile warning:

warning: 'php_set_error_handling' is deprecated (declared at /usr/lib64/php5/include/php/main/php.h:292)

This occurs many times within different functions.

Expected result:
----------------
No compiler warnings when compiling haru-1.0.0 as was the case with php-5.2


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-25 08:27 UTC] dave dot mulford at gmail dot com
A patch for this is below. I did not see any way to upload a patch file. Sorry.

===== PATCH =====

--- haru-1.0.0/haru.c     2008-11-19 08:48:57.000000000 +0000
+++ haru.c      2010-08-25 12:10:26.000000000 +0000
@@ -116,26 +116,29 @@
 #if PHP_MAJOR_VERSION < 6
 #define HARU_CHECK_FILE(filename)                                                                                                                              \
        do {                                                                                                                                                                            \
-               php_set_error_handling(EH_THROW, ce_haruexception TSRMLS_CC);                                                   \
+               zend_error_handling error_handling;                                                                                                             \
+               zend_replace_error_handling(EH_THROW, ce_haruexception, &error_handling TSRMLS_CC);             \
                if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {    \
-                       php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);                                                                      \
+                       zend_restore_error_handling(&error_handling TSRMLS_CC);                                                         \
                        return;                                                                                                                                                         \
                }                                                                                                                                                                        \
                if (php_check_open_basedir(filename TSRMLS_CC)) {                                                                               \
-                       php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);                                                                      \
+                       zend_restore_error_handling(&error_handling TSRMLS_CC);                                                         \
                        return;                                                                                                                                                         \
                }                                                                                                                                                                        \
-               php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);                                                                              \
+               zend_restore_error_handling(&error_handling TSRMLS_CC);                                                                 \
        } while(0)
 #else
 #define HARU_CHECK_FILE(filename)                                                                                                                              \
        do {                                                                                                                                                                            \
-               php_set_error_handling(EH_THROW, ce_haruexception TSRMLS_CC);                                                   \
+               zend_error_handling error_handling;                                                                                                             \
+               zend_replace_error_handling(EH_THROW, ce_haruexception, &error_handling TSRMLS_CC);             \
                if (php_check_open_basedir(filename TSRMLS_CC)) {                                                                               \
-                       php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);                                                                      \
+                       zend_restore_error_handling(&error_handling TSRMLS_CC);                                                         \
                        return;                                                                                                                                                         \
                }                                                                                                                                                                        \
-               php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);                                                                              \
+               zend_restore_error_handling(&error_handling TSRMLS_CC);                                                                 \
+       } while(0)
        } while(0)
 #endif
 [2010-08-25 08:32 UTC] dave dot mulford at gmail dot com
I apologize for the patch looking terrible. Here is a pastebin of it, that looks a bit better. http://pastebin.com/FG9xPXAm

Thanks!
 [2011-07-09 10:37 UTC] philip at roshambo dot org
This should probably take into account the ZEND API number 
that this changed in, although I don't know this topic very 
well... but #if ZEND_MODULE_API_NO > 20060613 looks about 
right.
 [2013-10-23 15:18 UTC] cmbecker69 at gmx dot de
Apparently, this has been already fixed, cf. 
<http://lxr.php.net/xref/PECL/haru/haru.c#116>.  This fix is 
contained in the latest stable version (1.0.4) available from PECL.
 [2013-10-23 16:04 UTC] tony2001@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: tony2001
 [2013-10-23 16:04 UTC] tony2001@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC