php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64278 Segmentation fault thrown on "?" operator
Submitted: 2013-02-22 15:02 UTC Modified: 2013-07-18 03:00 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: gabrielwu84 at gmail dot com Assigned: gabrielwu84 (profile)
Status: Closed Package: operator (PECL)
PHP Version: 5.4.12 OS: Ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gabrielwu84 at gmail dot com
New email:
PHP Version: OS:

 

 [2013-02-22 15:02 UTC] gabrielwu84 at gmail dot com
Description:
------------
<?php
$a = 1 ? 1 : date();
exit;
?>

That script gives me a Segmentation Fault under PHP 5.4.11 when the operator 
package is loaded.

Test script:
---------------
<?php
$a = 1 ? 1 : date();
exit;
?>



Patches

fix-0.4.1-PHP_OPERATOR_OPHANDLER_COUNT (last revision 2013-02-25 03:58 UTC by ku at digitaldolphins dot jp)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-25 03:57 UTC] ku at digitaldolphins dot jp
PHP_OPERATOR_OPHANDLER_COUNT doesn't match with recent PHP 5's one.

operator.c in operator-0.4.1:
---
#define PHP_OPERATOR_OPHANDLER_COUNT ((25 * 151) + 1)
---

PHP 5.4 has more. It'll need conditional check like following:
---
#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 5)
# error "Operator overload support requires newer PHP_OPERATOR_OPHANDLER_COUNT"
#elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 5)
# define PHP_OPERATOR_OPHANDLER_COUNT				((25 * 164) + 1)
#elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 4)
# define PHP_OPERATOR_OPHANDLER_COUNT				((25 * 159) + 1)
#elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 3)
# define PHP_OPERATOR_OPHANDLER_COUNT				((25 * 154) + 1)
#else
# define PHP_OPERATOR_OPHANDLER_COUNT				((25 * 151) + 1)
#endif
---

I'll attach a patch for this problem.

Thanks
 [2013-02-25 14:51 UTC] ryan dot brothers at gmail dot com
Thanks for the help.  That resolves the issue for me.
 [2013-03-26 23:34 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: gabrielwu84
 [2013-05-06 02:12 UTC] ryan dot brothers at gmail dot com
I encountered another segmentation fault.  I just entered https://bugs.php.net/bug.php?id=64777.
 [2013-07-18 02:53 UTC] pollita@php.net
-Status: Assigned +Status: Closed
 [2013-07-18 02:53 UTC] pollita@php.net
This got fixed with my version fixes last february.
 [2013-07-18 03:00 UTC] gabrielwu84@php.net
Bug fixed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC