php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34954 Segmentation fault when trying to set a Hebrew letter in GtkEntry
Submitted: 2005-10-22 03:19 UTC Modified: 2005-10-22 22:01 UTC
From: isotop at gmail dot com Assigned:
Status: Closed Package: PHP-GTK related
PHP Version: 2.0.0-dev (GTK) OS: Linux(gentoo)
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: isotop at gmail dot com
New email:
PHP Version: OS:

 

 [2005-10-22 03:19 UTC] isotop at gmail dot com
Description:
------------
Im using php-gtk2 from cvs.
when im trying to get an Hebrew letters from GtkEntry and put int in other GtkEntry i get a Segmentation fault.
i think its a pango related maybe?

Reproduce code:
---------------
#!/usr/bin/php-gtk
<?php
function delete_event()
{
    return false;
}

function shutdown()
{
    print("Shutting down...\n");
    gtk::main_quit();
}

function hello()
{
    global $window;
    print "Hello World!\n";
    $window->destroy();
}
/*
$window = new GtkWindow();
$window->connect('destroy', 'shutdown');
$window->connect('delete-event', 'delete_event');
$window->set_border_width(10);

$button = new GtkButton(phpversion());
$button->connect('clicked', 'hello');
$window->add($button);
*/
function on_button1_clicked()
{
global $php,$zend;
$php->set_text($zend->get_text());
//gtk::main_quit();
}
$glade = new GladeXML( dirname( __FILE__) . "/xml.glade");
$glade->signal_connect("shutdown","shutdown");
$glade->signal_connect("on_button1_clicked","on_button1_clicked");
$php = $glade->get_widget("php");
$php->set_text(phpversion());
$zend = $glade->get_widget("zend");
$zend->set_text(zend_version());
//$window->show_all();

gtk::main();
?>


Actual result:
--------------
#0  0x00002aaaab561bc0 in memcpy () from /lib/libc.so.6
#1  0x00000000005a4ce0 in _estrndup (s=0x0, length=9)
    at /home/isotop/php-gtk/php5-200510212230/Zend/zend_alloc.c:424
#2  0x00002aaaab80cf3c in zif_GtkEntry_get_text (ht=21206904,
    return_value=0x14193c8, return_value_ptr=0x9, this_ptr=0x0,
    return_value_used=0) at gtk.overrides:1236
#3  0x00000000005e2baa in zend_do_fcall_common_helper_SPEC (
    execute_data=0x7ffffffe04f0) at zend_vm_execute.h:188
#4  0x00000000005e255c in execute (op_array=0x1249ff0) at zend_vm_execute.h:88
#5  0x00000000005b0458 in zend_call_function (fci=0x7ffffffe0690,
    fci_cache=0x1243008)
    at /home/isotop/php-gtk/php5-200510212230/Zend/zend_execute_API.c:880
#6  0x00000000005b0ec6 in call_user_function_ex (function_table=0x1439778,
    object_pp=0x0, function_name=0x9, retval_ptr_ptr=0x9, param_count=0,
    params=0x8, no_separation=0, symbol_table=0x0)
    at /home/isotop/php-gtk/php5-200510212230/Zend/zend_execute_API.c:578
#7  0x00002aaaab86324b in phpg_closure_marshal (closure=0x1412840,
    return_value=0x0, n_param_values=1, param_values=0x0, invocation_hint=0x0,
    marshal_data=0x8) at /home/isotop/php-gtk/php-gtk/main/phpg_closure.c:113
#8  0x00002aaaac6a9a79 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#9  0x00002aaaac6bcfe4 in g_signal_has_handler_pending ()
   from /usr/lib/libgobject-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#10 0x00002aaaac6be2a7 in g_signal_emit_valist ()
   from /usr/lib/libgobject-2.0.so.0
#11 0x00002aaaac6be613 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#12 0x00002aaaabb8a428 in gtk_button_get_alignment ()
   from /usr/lib/libgtk-x11-2.0.so.0
#13 0x00002aaaac6a9a79 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#14 0x00002aaaac6bcd94 in g_signal_has_handler_pending ()
   from /usr/lib/libgobject-2.0.so.0
#15 0x00002aaaac6be2a7 in g_signal_emit_valist ()
   from /usr/lib/libgobject-2.0.so.0
#16 0x00002aaaac6be613 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#17 0x00002aaaabb89959 in gtk_button_set_relief ()
   from /usr/lib/libgtk-x11-2.0.so.0
#18 0x00002aaaabc45488 in gtk_marshal_VOID__UINT_STRING ()
   from /usr/lib/libgtk-x11-2.0.so.0
#19 0x00002aaaac6a9a79 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#20 0x00002aaaac6bd6cc in g_signal_has_handler_pending ()
   from /usr/lib/libgobject-2.0.so.0
#21 0x00002aaaac6be009 in g_signal_emit_valist ()
   from /usr/lib/libgobject-2.0.so.0
#22 0x00002aaaac6be613 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#23 0x00002aaaabd286a0 in gtk_widget_activate ()
---Type <return> to continue, or q <return> to quit---
   from /usr/lib/libgtk-x11-2.0.so.0
#24 0x00002aaaabc43841 in gtk_propagate_event ()
   from /usr/lib/libgtk-x11-2.0.so.0
#25 0x00002aaaabc43b8c in gtk_main_do_event ()
   from /usr/lib/libgtk-x11-2.0.so.0
#26 0x00002aaaabf89440 in gdk_event_get_graphics_expose ()
   from /usr/lib/libgdk-x11-2.0.so.0
#27 0x00002aaaac9074e6 in g_main_context_dispatch ()
   from /usr/lib/libglib-2.0.so.0
#28 0x00002aaaac908f08 in g_main_context_acquire ()
   from /usr/lib/libglib-2.0.so.0
#29 0x00002aaaac90926a in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#30 0x00002aaaabc43061 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#31 0x00000000005e2baa in zend_do_fcall_common_helper_SPEC (
    execute_data=0x7ffffffe1f00) at zend_vm_execute.h:188
#32 0x00000000005e255c in execute (op_array=0x1243008) at zend_vm_execute.h:88
#33 0x00000000005bc3c9 in zend_execute_scripts (type=8, retval=0x0,
    file_count=3) at /home/isotop/php-gtk/php5-200510212230/Zend/zend.c:1087
#34 0x0000000000580f49 in php_execute_script (primary_file=0x7ffffffe4690)
    at /home/isotop/php-gtk/php5-200510212230/main/main.c:1677
#35 0x000000000064dca9 in main (argc=2, argv=0x7ffffffe47d8)
    at /home/isotop/php-gtk/php5-200510212230/sapi/cli/php_cli.c:1042


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-22 13:35 UTC] isotop at gmail dot com
xml.glade:
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">

<glade-interface>

<widget class="GtkWindow" id="window1">
  <property name="visible">True</property>
  <property name="title" translatable="yes">PHP-GTK2 test app</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property name="window_position">GTK_WIN_POS_NONE</property>
  <property name="modal">False</property>
  <property name="resizable">True</property>
  <property name="destroy_with_parent">False</property>
  <property name="decorated">True</property>
  <property name="skip_taskbar_hint">False</property>
  <property name="skip_pager_hint">False</property>
  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
  <signal name="destroy" handler="shutdown" last_modification_time="Sat, 22 Oct 2005 00:44:14 GMT"/>

  <child>
    <widget class="GtkFixed" id="fixed1">
      <property name="visible">True</property>

      <child>
        <widget class="GtkEntry" id="php">
          <property name="width_request">158</property>
          <property name="height_request">25</property>
          <property name="visible">True</property>
          <property name="can_focus">True</property>
          <property name="editable">True</property>
          <property name="visibility">True</property>
          <property name="max_length">0</property>
          <property name="text" translatable="yes"></property>
          <property name="has_frame">True</property>
          <property name="invisible_char">*</property>
          <property name="activates_default">False</property>
        </widget>
        <packing>
          <property name="x">112</property>
          <property name="y">8</property>
        </packing>
      </child>

      <child>
        <widget class="GtkEntry" id="zend">
          <property name="width_request">158</property>
          <property name="height_request">25</property>
          <property name="visible">True</property>
          <property name="can_focus">True</property>
          <property name="editable">True</property>
          <property name="visibility">True</property>
          <property name="max_length">0</property>
          <property name="text" translatable="yes"></property>
          <property name="has_frame">True</property>
          <property name="invisible_char">*</property>
          <property name="activates_default">False</property>
        </widget>
        <packing>
          <property name="x">112</property>
          <property name="y">40</property>
        </packing>
      </child>

      <child>
        <widget class="GtkLabel" id="label2">
          <property name="width_request">88</property>
          <property name="height_request">24</property>
          <property name="visible">True</property>
          <property name="label" translatable="yes">ZEND Version</property>
          <property name="use_underline">False</property>
          <property name="use_markup">False</property>
          <property name="justify">GTK_JUSTIFY_LEFT</property>
          <property name="wrap">False</property>
          <property name="selectable">False</property>
          <property name="xalign">0.5</property>
          <property name="yalign">0.5</property>
          <property name="xpad">0</property>
          <property name="ypad">0</property>
        </widget>
        <packing>
          <property name="x">8</property>
          <property name="y">40</property>
        </packing>
      </child>

      <child>
        <widget class="GtkLabel" id="label1">
          <property name="width_request">88</property>
          <property name="height_request">24</property>
          <property name="visible">True</property>
          <property name="label" translatable="yes">PHP Version</property>
          <property name="use_underline">False</property>
          <property name="use_markup">False</property>
          <property name="justify">GTK_JUSTIFY_LEFT</property>
          <property name="wrap">False</property>
          <property name="selectable">False</property>
          <property name="xalign">0.5</property>
          <property name="yalign">0.5</property>
          <property name="xpad">0</property>
          <property name="ypad">0</property>
        </widget>
        <packing>
          <property name="x">8</property>
          <property name="y">8</property>
        </packing>
      </child>

      <child>
        <widget class="GtkButton" id="button1">
          <property name="width_request">248</property>
          <property name="height_request">24</property>
          <property name="visible">True</property>
          <property name="can_focus">True</property>
          <property name="label" translatable="yes">Quit</property>
          <property name="use_underline">True</property>
          <property name="relief">GTK_RELIEF_NORMAL</property>
          <property name="focus_on_click">True</property>
          <signal name="clicked" handler="on_button1_clicked" last_modification_time="Sat, 22 Oct 2005 00:42:12 GMT"/>
        </widget>
        <packing>
          <property name="x">16</property>
          <property name="y">72</property>
        </packing>
      </child>
    </widget>
  </child>
</widget>

</glade-interface>
 [2005-10-22 19:59 UTC] sfox@php.net
1) Where is the Hebrew text? This script doesn't have any.. and the Zend and PHP versions are hard-coded in English.. I need to be able to reproduce what you're seeing before I can fix anything.
2) What is your codepage setting (in your php.ini)?
3) Shorter scripts are very much welcomed.  Example:

<?php

function shutdown() {
    print("Shutting down...\n");
    gtk::main_quit();
}

function on_button1_clicked($php, $zend) {
    $php->set_text($zend->get_text());
}

$glade = new GladeXML( dirname( __FILE__) . "/xml.glade");
$glade->signal_autoconnect();

$php = $glade->get_widget("php");
$php->set_text(phpversion());
$zend = $glade->get_widget("zend");
$zend->set_text(zend_version());

gtk::main();

?>
 [2005-10-22 22:00 UTC] sfox@php.net
OK, I spent some time now doing battle with my (UK) setup and the contents of an old email with a Hebrew date on it:

<?php

function shutdown()
{
    print("Shutting down...\n");
    gtk::main_quit();
}

function on_button1_clicked()
{
global $php, $zend;

$php->set_text($zend->get_text());
}

$glade = new GladeXML( dirname( __FILE__) . "/xml.glade");
$glade->signal_autoconnect();

$php = $glade->get_widget("php");
$php->set_text("??? ????? 18 ???????");
$zend = $glade->get_widget("zend");
$zend->set_text("??? ????? 10 ???????");

gtk::main();

?>

(forgive the Unicode - assuming that's what it comes out as after I press submit - on my laptop and in my codepage setting it's ISO-8859-8)

All I can think is that a) you've skipped the codepage setting or b) you didn't install Pango's runtime Hebrew support, because it works perfectly here.  I'm therefore closing this report.
 [2005-10-22 22:01 UTC] sfox@php.net
Remembering to change the status might've been a smart move on my part :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC